Correcting Lens Aberrations in Digital Photography?
Kavau asks: "I've recently entered the world of digital photography, and bought a pocket-sized digital. While the resolution and the color accuracy are very nice, I was utterly disappointed by the (lack of) quality of the zoom lens: It has a clearly visible barrel distortion, especially in wide angle, so that straight lines appear curved in the picture. This is especially annoying in architectural shots or cityscapes. While grumbling about this shortcoming, I suddenly realized that I am dealing with digital imaging here: In principle it should be no problem to measure the distortion, and then to correct it with a digital mapping. Other lens faults such as vignetting could also be corrected. Now, since I don't want to reinvent the wheel, here is my question to Slashdot: Do you know of any open-source tools that deal with issues such as (1) applying general analytic transformations to a picture, (2) specifically correcting for barrel distortion, or (3) determining the amount of distortion from test pictures? Also, since people probably had this idea before, does anyone have experience with this issue that he/she wants to share, or some resources to point out?"
...that your best bet would be to take a picture of a piece of graph paper, and then figure out exactly how to stretch it so that the lines are straight again. That said, I'm not entirely certain if there are any programs out there that would do this, but I think it'd be reasonably easy to write an OpenGL program that allows you to apply arbitrary distortions to an image, and then saves those distortions to apply to other images.
Check out PanoTools at http://www.path.unimelb.edu.au/~dersch/
It has a steep learning curve, but seems to be worth the effort. I've only played around with it some myself but I've seen lots of (seemingly) professional photographers on the web that use it.
Exellent tutorials: Big Ben's Panorama Tutorials
Search string: photo barrel distortionm
4'th link down:
www.philohome.com/barrelpers/barrelpers.ht
It mentions to use the "panorama tools" package, which is open source. However, from what I remember, someone sued the author for patent infringement or something, so he no longer has it on his web site www.fh-furtwangen.de/~dersch/, but I found it on www.path.unimelb.edu.au/~dersch/
This has been a problem in traditional photography for some time. Distortion for wide angle shots always occurs for any wide angle shot -- try a 28mm lense sometime and see for yourself.
Special lenses do exist to correct for this. However, the are very expensive. Generally, only architecture photographers and other professionals have them.
You'll probably want a better lens anyway for doing any sort of quality photography. Oh, and as for fixing it with a filter, good luck. Its not as easy as just applying a transform as the person with the graph paper suggests. The warping depends on distance from the lens.
ph34r teh p0w3r 0f th3 c0w
Woodle, Alan S., Scott Elliott: The Vector system for dynamic gait analysis. Clinics in podiatric medicine and surgery. 10(3)485-500, 1993.
There are referances to the math in that paper. Good key words to google might be DLT & photogrametry (sp?)
VIPS is a wonderful image processing library with all sorts of "evil stuff", NIP is a GTK interface to the library which gives you a kind of spreadsheet for images. I'm telling the author about this slashdot item so he can come and pimp it here himself, but in the mean time take a look.
I have personally used it for analysis of medical images, it's nice and versatile, although the built in scripting language is a bit sick (imo).
-Yarn - Rio Karma: Excellent
http://www.humansoftware.com/pages1200/PhotoFixle
Photoshop plugin for exactly this issue. Dont' know how well it works but it may be just waht you're looking for... Mac and Windows.
A fool throws a stone into a well and a thousand sages can not remove it.
You may be familiar with the concept of a picture plane that is used in perspective drawings. The idea is that a transparent sheet is placed between the object and the eye, and rays are mapped onto the surface. That works fine for narrow fields of vision, but it falls apart as the lens gets wider.
Imagine an extreme case: You are standing in a train station. To your left the tracks disappear to a point on the horizon, straight ahead of you the train sits, and to your right the tracks disappear off to another point. If this image is cut up into small enought chunks, you won't notice the abberations of traditional perspective. You have a one point perspective of the train, and a two point perspective on each side. But try to stitch the images into a whole, which is similar to what you are trying to do with a wide angle lens, and all those straight lines are going to have to bend somewhere!
A more accurate picture plane, one that could actually capture a real image without any distortion, would be a sphere, with the eye at the center. Straight lines now map to great circles on the sphere, and whole images, just like the ones your eye sees, can be presented in their entirety.
But then you can't exactly paste them into your photo album. So you are back to the question of, how do you map a sphere onto a plane?
Or maybe you could get some funny looking virtual reality googles.