8
$\begingroup$

I attempted to produce a kind of miniature faking look from a street scene photo. I tried to shift the perspective lines close to parallel to each other to obtain such effect. However, the result looks ugly. Is there a better way to do it?

This is the original photo.

This is the original photo.

This is the result from the code below.

enter image description here

im = Import["http://i.stack.imgur.com/AkqJW.jpg"]

pts = {{0, 0}, {0, 1}, {0.25, 0},  {0.25, 1}, {0.5, 0}, {0.5,1}, {1, 0}, {1, 1} };
imgcol = BSplineFunction[ImageData[im ], SplineDegree -> 1];
Manipulate[
  Module[{f},
   f = BSplineFunction[Partition[pts, 2], SplineDegree -> 1, 
    Method -> {"Extrapolation" -> "Clamp"}]; 

  ParametricPlot[
   f[u, v], {u, 0, 1}, {v, 0, 1},
   ColorFunction -> (imgcol[1 - #4, #3] &),
   MaxRecursion -> 0,
   PlotPoints -> ControlActive[20, 100],
   Mesh -> None, 
   Epilog -> { Gray, Opacity[.7], Line[Partition[pts, 2]]}, 
   ImageSize -> {300, 300},
   PlotRange -> {{0, 1}, {0, 1}},
   PlotRangePadding -> Scaled[0.01],
   FrameTicks -> None
   ] 
  ],
 {{pts, {{0, 0}, {0, 1}, {0.25, 0},  {0.25, 1}, {0.5, 0},  {0.5, 1}, 
   {1, 0}, {1, 1} }}, {0, 0}, {1, 1}, Locator },
 TrackedSymbols :> {pts}
 ]
$\endgroup$
8
$\begingroup$

“Tilt-shift” effect depends on the mask. Here is a full blown app with downloadable source code:

Digital Tilt-Shift Photography

enter image description here

$\endgroup$
2
$\begingroup$

I was always under the impression that a tilt-shift effect was achieved by blurring the top and bottom of a picture. This is supposed to imitate a shallow depth of field.

mask = Image @ Table[With[{c = 150 - 50 x/300}, Abs[y - c]/c], {y, 300}, {x, 300}];
ImageFilter[Mean@Flatten@# &, image, 5, Masking -> mask]

tilt

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.