Sunday, May 9, 2010

PTLens and CS5 – Remove Keystone Distortion and Replace Missing Details

I’ve blogged about PTLens in the past. Some probably think that the addition of lens distortion correction to Photoshop CS5 has eliminated the value of PTLens. Well, in my opinion far from it. PTLens provides distortion correction for many small sensor cameras that CS5 can never afford to concern itself with. And PTLens has very easily mastered controls for perspective correction, specifically the elimination of keystoning in your image.

As the first stage in processing, you should remove all distortions and crop to the look you want. That way, you do not waste any energy or computer power on processing parts of the image that you will ultimately remove. Some of these extra elements can be distracting and lead to a less than optimal result by confusing the eye.

This article is the first stage in the HDR processing of an image in my article on Topaz Adjust 4.


PTLens is sold through ePaperPress on this page. It is inexpensive and runs stand-alone or as an external editor for Lightroom or a plugin in Photoshop. It supports 8 and 16 bit color, and it support 32 and 64 bit versions of CS4 and CS5. 32 bit only in earlier versions of Photoshop. I also runs in Elements. And on the MAC in Lightroom (I think.)


The controls at the bottom-middle are the meat of the tool. It will read the EXIF info and do its best to guess which lens or camera you have, and it is usually right on. You can switch the distortion correction on and off at will, which is useful if you want to run the tool more than once. You can only correct lens distortion once, after that you are introducing the reverse distorions, and good luck trying to correct *that* :-)

By the way, for any lens or camera that is unknown, you *must* disable barrel-pincushion correction, else the OK button is never enabled. Also, the Scale button is *only* enabled if you touch one of the other correction buttons. So if all you want to do is to correct barrel distorion and scale the image, well, no can do. I hope Thomas fixes that one day. If *any* changes are made, the scale button should be enabled. In fact, why not enable it no matter what? His resizing algorithms seem rather good.

On the right, you have three tabs. My goal with this article is to demonstrate the middle tab, Perspective correction. I can say that the vignette correction is very useful. I often use this one in preference over Photoshop. It again has sliders that seem to have a good level of control without feeling twitchy. I have to say that I rarely use his Chromatic Aberration correction though, as I quite like the corrections in ACR5 and ACR6. I also like my Shay Stephens fringe removal action. But I’m sure it does the job.

Back to the work flow.

You can see that PTLens has correctly guessed the camera and lens used for this image. And it has removed the pincushion distortion inherent in most consumer zoom lenses.


In this image of just the image panel in the dialog, I have turned on the grid, which makes a huge difference when scanning for perspective issues. I can see from this that the buiding is leaning outwards, a case of reverse keytoning caused by shooting the building from above at a downward angle. I need to dial the sliders a bit to push the top of the building together and that often also requires a bit of rotation. You find that these two sliders interact the most often when working with perspective.


The final result required +12 of vertical distortion correction and –0.2 of rotation. A very small amount, but it is amazing what the eye sees, especially when the lines are near the border, as is our horizon. The final result from PTLens looks like this.


Obviously, I did not use the built in scaling capability. That’s because I want finer control of this crop. I was to try to save the gentleman looking over the lady’s shoulder, which I did not do the first time I processed this image in Topaz Adjust. This time, though, I have the CS5 content-aware fill to help me out. So first I crop:


The crop tool works very well for this task, and does not change the pixels or resolution unless you tell it to. I always leave those moxes empty and only fill in the dimensions, which is really just the proportions or more accurately the aspect ratio of the crop. And you can see that I will be forced to recreate the upper left corner, which was removed by the original pincushion distortion fix.


To fill in the area, select with the lasso tool and hit delete. This brings up the fill dialog to select the content you want to replace the deleted area with. CS5 adds the new “content-aware” fill, which is wicked powerful. It does wondrous things at times.


I can’t really call this a wondrous job, but it has certainly left me with little to do. Just paint in the top of the bubble and paint out the reflection above their heads and all will be well.


That’s pretty good. And of course, when reduced to normal viewing sizes, the repair is invisible. For advanced photographers or enthusiasts, I highly recommend the Photoshop tools. There is a ton of info on these and the advanced nature of the tools and filters makes short work of certain difficult tasks.

Now you can go back to the Topaz Adjust 4 article to continue with this image.


Stacey said...

Hello Kim,

You're right about the Photoshop "Distortion" menu being of "limited use". I've tried it, but it only works partly, especially for very wide-angle lenses (e.g. Canon T1i with a 10-22mm Canon lens).

Also, when one tries to correct any architectural distortion through Select All>>Transform or Free Transform, both left and right sides are affected. So trying to straighten the right side divergence affects the left side and vice versa.

I'm, surprised that not one else has been here to your , since your comment is valuable.

What I've also noticed with regard to any new software coming out (Photoshop or any other software) is that almost everyone simply copies the comments of almost everyone else, without even having tried the Beta version or the new release!

Example: Check out a search for CS5 Photoshop Grid size, and you'll come across the term many times:

"The show grid, grid size and grid color are now sticky"

What "sticky" is, I have no idea.

I'm going to check out the PTlens that you mentioned.

Kim Letkeman said...

Stacey: Thanks for the kind words. PTLens is terrific, and he'll add any lens or camera for which you can create the appropriate calibration images. I did that for the F70/F80 and he turned around a new version of PTLens in 24 hours. Excellent tool.