Thursday, 19 October 2017

Principles of correcting perspective in software


I am interested in photographing buildings such that the vertical lines are preserved. As shown in the image on the right.


tilt shift image


I understand that this can be achieved with a tilt-shift lens. However, my Fujifilm X100 has a fixed lens, so I wont be able to do this with my current camera.



So I am interested in achieving a similar result using software. Note that I am not after that "minature" look with shallow depth of field at a long distance. This is what most software that is billed as "fake tilt-shift" seems to reproduce.


I simply want my vertical lines to be preserved.


Is this as simple as projecting a rectangular image onto a trapezoid? Just squashing the bottom edge of the rectangle? Or is it more involved than this? Is the projected shape more complex that a trapezoid perhaps?


distortion


I don't have access to Photoshop, but do use Gimp and Inkscape. And if needed, can write my own software. To clarify, I am after the actual geometric transformation.



Answer



Although many lenses that have the ability to control one also have the ability to control the other, tilt and shift are two different movements.


The "miniature" look is achieved using tilt movements. The optical axis of the lens is tilted away from a perpendicular angle with respect to the imaging plane.


tilt movement


Correcting perspective in terms of converging lines is accomplished optically using the shift movement. The 90° angle of the lens' optical axis with respect to the imaging plane is maintained. The center of the lens' optical axis is moved away from the center of the film or sensor while remaining perpendicular to the plane occupied by the film/sensor.



shift movement


Assuming the building is perpendicular to the ground, this has the same effect as pointing the lens' optical axis horizontally and then cropping away all but the top part of the image. Shift lenses have larger image circles than the formats they are designed to be used with, so the field of view can be shifted fairly far to one side or another of the image circle cast by the lens and we don't have to give up resolution by cropping a significant portion of the image.


enter image description here


It is possible to tilt the camera up at the building and correct for the converging lines using software. Of course, any time we start remapping pixels we give up a small but measurable amount of resolution.



Is this as simple as projecting a rectangular image onto a trapezoid? Just squashing the bottom edge of the rectangle? Or is it more involved than this? Is the projected shape more complex that a trapezoid perhaps?



It depends upon the characteristics of the lens you are using and whether or not the camera provides lens distortion correction. If your lens has any significant geometric distortion, you'll need to correct for that before doing your trapezoidal projection to correct for the perspective "distortion" caused by your shooting position. Be careful, though. If your camera already does geometric distortion correction automatically you don't need to apply it again.


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...