• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

TIPS & TRICKS No. 6 - Perspective Correction

Tim Armes

New member
This thread is part of the Tips & Tricks problematics. See here for more information.

Hi all,

A tips and tricks theme from Doug Kerr today. Doug started a previous thread with this question:

I sometimes have to correct for perspective effects in post-processing when doing something like taking a photgraph of a quilt design when I can't shoot it head on (and don't have a tilt/shift lens either) but want a rectilinear mapping of the object in the image.

My image editor has what is described as a perspective correction facility, but it turns out that it really isn't. What it allows is to take an object containing the original image and stretch it along one axis and "make it trapezoidal" as well.

This gives me a representation of the rectangular object that is rectangular, all right, and with the right overall aspect ratio, but not rectilinear. The reason of course is that the geometry of the shot results in a non-linear stretching of the object features from "top to bottom" of the shot.

So, for example, if I was shooting a quilt made up of square blocks, when I am done the blocks at the original "far side" will not be square in the image, although those at the near side are square.

Another way to say this is that I can fix the image so the vertical edges of buildings are straight lines in the image, but diagonal lines on the face of the building (as on the "Dos Equis" building in Dallas) are not.

Will Photoshop let me actually deal with this? I haven't played yet, and the discussion in the help system isn't encouraging.

If not, are there other tools to do this in postprocessing?

Here's a small version of the image that Doug would like to correct:

Quilt-small.jpg


Please feel free to join in and offer and post-processing suggestions. For this, I'm also hosting a larger version of the file.

Regards,

Tim
 

Ray West

New member
The first thing I have to do, is some basic sums. I guess you want a view as if you were looking straight down on the quilt. Now the length of the bottom edge must be the same as the top, within the limits of quilt making, and both sides must be the same length as each other, and at 90 degrees to the top/bottom. The sum you can't calculate easily, is the length of the sides, the relationship with the length of the top and bottom edges. (If it's important, when I take a similar photo, I place a known sized object in the frame. )

Without that information, the best I think I can do is guess the ratio of the sides. But I'll give it a whirl

Best wishes,

Ray
 

Doug Kerr

Well-known member
PTLens!

Greetings,

Since I first started this discussion, I discovered that modern versions of Thomas Nieman's PTLens program include a first-rate perspective "correction" facility. (I put "correction" in quotes since of course the effects of perspective are not, for example, any kind of distortion nor aberration!)

I recently downloaded version 8.5.2 of this wonderful tool (it exists in both stand-alone and PS etc. plugin versions, both now coming in the same install package).

It does a wonderful job of just what I needed. Here is a quick example (on the same image Tim put up at the opening of this thread).

Quilt-layout_test_E28161-03R.jpg


After the perspective negation (!), I also used a gradient mask in my editor to adjust the lightness to compensate for illumination falloff (direct flash used) and to apply some selective sharpening to deal with DoF problems (too much of that, and not ideally distributed, as you can see, but this should serve to illustrate the real point).

One hint regarding PTLens. In this situation, I used the "vertical perspective" slider. As the amount of effect was increased (I needed a lot - the shot was very oblique), the top part of the image was lost owing to running out of "canvas" as the upward direction was stretched (nonlinerealy, as required to really do this job).

Tom Nieman speaks of the ability of PTLens to scale and shift the corrected image before delivery to avoid loss of content, but in fact it doesn't solve the problem in this case.

The solution was to expand the "canvas" of the image in my editor before submitting it to PTLens.

I'll be doing some more "reverse engineering" on this wrinkle when I can.

In any case, big Kudos to Tom Nieman for PTLens.
 

Ray West

New member
using cs2, crop the rug into a new layer, (always use plenty of layers, so you can go back to a previous effort) then use filter/distort/lens correction vertical perspective (you need to do it twice, since seems 100% not quite enough). second time do a tad of horizontal perspective correction too. You need to zoom in, else its off your selected area. Crop again, then use edit/transform/warp to straighten edges. If you select an area into a new layer, you can straighten out the squiggles, if you wish, using warp on the selected area. I have an acetate film, printed with squares, held on the screen, it gives a quick check for squareness (I can't find it at the mo., but it looks good enough, if not more warping. (or you could use a drawn grid layer at 50% opacity to do the same) . Finally, use transform/scale to get it into the right rectangular shape - if you know what it is.

This was done quickly, to show the concept. The results are sort of proportional to the time you spend, as usual. A lot of detail will be generated/lost, in the perspective changes - I only messed with the small jpeg. I think, given the lens details, if I was bothered, I could calculate the size of the quilt, more or less.


quilt.jpg



Best wishes,

Ray
 

Ray West

New member
Hi Doug,

you posted as I was composing. I think your quilt is rectangular, not square. cs2 has a similar perspective correction, as I mentioned. To fine tune, you need the distort function.

Best wishes,

Ray
 

Doug Kerr

Well-known member
Hi, Ray,

Neat-o! I guess some day I should learn to use Photoshop!

I'll go play now whith what you described.

Thanks so much.

Best regards,

Doug
 

Ray West

New member
Hi Doug,

I'm really very, very pleased to be able to help you, just a little payback for the excellent help you freely offer to everyone on your 'pumpkin site'.

Best wishes,

Ray
 

Doug Kerr

Well-known member
Hi, Ray,

I think your quilt is rectangular, not square.

Yes, it was about 97" wide x 104" high (but not exactly rectangular, as the pieces were just laid out roughly.)

cs2 has a similar perspective correction, as I mentioned. To fine tune, you need the distort function.

Yes, I just played a little with the perspective function, following your description. It works very much lkike the PTLens facility.

Best wishes,

Ray[/QUOTE]
 

Doug Kerr

Well-known member
Well, now I realize that Photoshop (i.e., CS2) has two different "perspective" tools. (I know you guys knew that, and were talking about it, but I missed that fact.)

One, at Edit|Transform|Perspective, is a special case of the generalized bilinear transform, with the "trapezoidal" constraint.

It will not transform an image taken obliquely so it exhbits the perspective effects of a "head-on" shot (a tedious but pecise description of what is usually actually our objective when we strive for "perspective correction"). This tool of course has no business being labeled "perspective".

To use the architectural photography metaphor, this tool will make the rectangular front of a bullding come out rectangular in the image, but the windows on the upper floors will not appear with their actual aspect ratios!

The other, at Flter|Distort|Lens correction, actually makes the nonlinear (trigonometric, actually) transform required to do the task I mentioned above.

It is very similar in its organization and operation to the perspective adjustment capability of PTLens.

Best regards,

Doug
 

Michael Fontana

pro member
Another methode would be using stitching apps like AutopanoPro, but Hugin can do so as well:

BTW: The Mac-counterparth of PTlens, The Panotools-plugins from www.kekus.com have that option too, but its easier with APP.

Just load two copies of the same shot in APP, and draw the vertical lines; one might even use the horizontal lines option in the brand-new 1.4.

Here's the result, quick and dirt, just from the initial jpg:

Quilt-APP.jpg
 

Doug Kerr

Well-known member
I thouhgt that, having opened the door by my "tedious" language above. I would comment a little on the matter of "perspective".

We have a tendency to speak of perspective as the phenomenon in which lines that are parallel in space show up as converging lines in our image.

In that state of mind, imagine that we consider a situation in which we shoot "head on" at a small rectangular billboard, behind which is a larger billboard (whose plane is parallel to the first).

We see no converging lines in the image, and thus have a tendency to say "there is no perspective in this image".

In fact, perspective refers to the entire result of projecting this three dimensional "scene" onto a two dimensional image, as a result of viewing the scene from a particular location of the viewer (the "point of perspective").

In the example above, although the larger billboard might have twice the linear dimensions of the smaller one, it will not be twice as large in the image (owing to its greater distance from the viewer). That is a manifestation of the perspective situation here.

Now, a typical common concern with perspective is when we have taken a shot of nice plane building facade when we cannot aim the camera directly at the center of the facade. (To be really precise, the problem arises when the film plane isn't parallel to the facade.) So we stand in the street, and aim the camera upward so as not to waste half the frame with street in the image.

As a result, the building facade (which we will assume has a rectangular outline) shows up on the image as a trapezoid (with the vertical edges at the sides of the facade now converging); if all the windows are actually the same size and square, on the image they will all be trapezoids; the upper ones will be smaller than the lower ones; and the upper ones will be "squashed" vertically in aspect ratio compared to the lower ones.

Now the image we get is exactly what the eye, regarding the building from that same spot, with that same "aim point", would record. There is no anomaly in the camera image.

But our client would like the building facade to look rectangular, with all windows square and the same size, just like on the architect's rendering.

This is what we would have gotten if we had shot the subject building straight on out of the window of the 4th floor ladies' restroom in the CIA office in the building across the street. But we were't able to do that.

(Of course there would have been perspective effects there too - they just wouldn't include "the vertical edges of the facade coming out convergent" and "the windows having different sizes". There are perspective effects in any photograph.)

So we seek to modify the image "so the perspective effects resulting from the oblique shot are changed to be the same as the perspective effects we would have had in the straight-on shot".

Not to "remove perspective".

Not to "correct perspective".

But rather to change it from what we got in our shot to what we would have had in a shot that produced the result the client wanted.

Best regards,

Doug
 

Chip Springer

New member
The Crop Tool is made for this...

(generally...however, when I tried it on your small image the top was blurred compared to what PTLens could do).

Anyway, when taking photos where you can't get a straight on shot (such a wall picture in a frame with glass)...

Use the crop tool and make it larger than the subject.
Check PERSPECTIVE box.
Move the corner (boxes) of the Crop tool to the corners of the subject and click ENTER....that's it.
 

Doug Kerr

Well-known member
Hi,Chip

(generally...however, when I tried it on your small image the top was blurred compared to what PTLens could do).

Anyway, when taking photos where you can't get a straight on shot (such a wall picture in a frame with glass)...

Use the crop tool and make it larger than the subject.
Check PERSPECTIVE box.
Move the corner (boxes) of the Crop tool to the corners of the subject and click ENTER....that's it.

(I start by assuming you are speaking of the Crop tool in Photoshop.)

Sorry - that doesn't do it. It stretches the image so that rectangular portions of the object are rectangular in the image, removing the converging lines, but it doesn't apply the nonlinear transform that is required so that, for example, consistent-size object features are of consistent size in the image.

Best regards,

Doug
 

Chip Springer

New member
Hi,Chip



(I start by assuming you are speaking of the Crop tool in Photoshop.)

Sorry - that doesn't do it. It stretches the image so that rectangular portions of the object are rectangular in the image, removing the converging lines, but it doesn't apply the nonlinear transform that is required so that, for example, consistent-size object features are of consistent size in the image.

Best regards,

Doug


The crop tool didn't work on the quilt because it stretched the pixels too much on that one end vs. narrowing the wider end and keeping everything focused.

Here is a better example using only the Crop Tool with perspective checked. A flashed was used and the frame has glass...much easier than trying to clone out a reflection.

Cropperspec.jpg
 

Frank Heinig

New member
Hi, I'm Frank, the Newbie, at here.

For perspective correction a photo also can used the tool DigitalPhotoShifter.
This allow to correct converging verticals in a photo exactly like a shift- objective - especialy the geometry of objects in the image.

Also possible is the totaly correction of booth, converging verticals and converging horizontals at the same time. Important therefor is that tghe properties of details (width/ heigt of a window) are the same like in original.

That's correct under following condition: the real focal- lenght must be used in adjustment of the tool.

In the last demonstration by Chip Springer it's my impression, that the resulting image a little bit to small. But this is my suggestive impression.

It would be nice mailing the original picture to me. Then i could exactly test the right proporty with PhotoShifter.

best regards
Frank

PS: Sorry for my wrong english.
 
Top