Converting Fish Eye image to Panoramic image?

9 views (last 30 days)
I have acquired a fish eye lens image of the sky and I would like to "unfold" this image, in matlab, into a Panoramic image instead of spherical. I am having a very hard time figuring out how to do so. I've found a function in MATLAB, which I think might be useful:
[x,y,z] = sph2cart(azimuth,elevation,r)
But i simply can't figure out how to use it.
I was wondering if any one might have created an example of how to use this function to convert an image from Spherical to panoramic coordinates.

Accepted Answer

Image Analyst
Image Analyst on 3 Apr 2014
Edited: Image Analyst on 3 Apr 2014
In optical distortion, the distance the pixel moves from its correct location is proportional to the cube of the radius from the optical axis. In other words:
rBad = rTrue + df * rTrue;
Where rTrue is where it should be if there were no distortion, df is the magnitiude of the fish-eye effect, and rBad is where it actually is (because of the distortion). You can use that formula to get find out where bad pixels should get mapped (sent) to. Make a grid of every 10 pixels or so and find out what their true location should be.
Then I believe you can use those locations (the actual bad locations, and the desired good locations) in imtransform() to un-distort the image. Give it a try. Demo attached. See if you can finish it by using imtransform().
The + are the distorted points and the o are the corrected points. Not sure why the legend function is not realizing what points are what.
  9 Comments
Neil
Neil on 30 Jan 2024
Not sure if this is worth it's own question or not, but you seem like the best person to ask. Suppose I have a cube of material with a index of refraction that varies in a known way, like a GRIN lens. I can calcuate the optical path lengths and get the optical path difference as a function of position on the imager. So I know . Then say I have one the matlab stock images, like cameraman.tif. How would I go about calculating what the image would look like when viewed through this material.
So basically trying to do something similar to the answer above, but instead of a fish eye, it is some arbitrary aberation.
Thanks.
Image Analyst
Image Analyst on 30 Jan 2024
@Neil I don't believe MATLAB has any kind of general functions for that. You'd have to write your own. Or you can use an optical design program like FRED
or Code V

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!