Hi guys, I am working on Barrel distortion correction using MATLAB. I have written code as per correction algorithm. I am unable to mathematically compare corrected output with original image can you suggest me some parameter for it..

23 views (last 30 days)
Basically Barrel distortion is image appears like fisheye image. straight line appears as curve due to use of wide angle lens. Correction depends on input parameter that is correction factor. Now as i vary correction factor i am getting nearby similar but corrected image. Hence i need to mathematically justify exact output.
As per correction algorithm used my code is giving me corrected image for input distorted image. But i am unable to compare my result using some standard parameter.Its just visually i could say that it is corrected.
I have attached input output images and code here.Please suggest how could i work forward in this?
Will correlation between images give me what i require?
  3 Comments
Image Analyst
Image Analyst on 20 Oct 2017
Of course. Distortion is a third order optical aberration where the point moved inward (barrel) or outward (pincushion). The distance it moved, delta r, is proportional to the radius. So the formula is
rNew = rOld + factor * rOld^2;
Najwa Anwar
Najwa Anwar on 31 Oct 2017
I do not have information regarding the rOld and the factor. Is it provided by the lens manufacture or I can get it from calculating from the image? (I'm sorry but I have zero knowledge on optics and I need to create a matlab code with precise correcting factor, k value).

Sign in to comment.

Answers (2)

Bjorn Gustavsson
Bjorn Gustavsson on 9 Feb 2017
Well, if the only thing you have is the original image you cant really tell. You kind of have to trust the task-givers world that it is made with a fish-eye lens. Then you'll have to assume that there are a reasonable number of edges (houses, lamp-posts, telegraph poles and the like) that are straight in reality (this is obviously not a given, but a good assumption). Then you'll have to find a correction factor that transform these edged in the fish-eye image to straight lines in the "corrected" image.
HTH
  3 Comments
Bjorn Gustavsson
Bjorn Gustavsson on 10 Feb 2017
Well, if you want to compare your "corrected" image with the original, just apply the inverse of the correction to make sure that you get the original image back?
Or take a couple of cuts (preferably horizontal and vertical) through your original image and the corresponding corrected images (just transform the pixel-coordinates of the cuts and get the image coordinates in the "corrected" image by interpolation) and show that they correlate very well? For extra credibility do the same in the opposite direction.
I'd just take a look at the images and check that features in the fish-eye images that I know to be straight line-features are corrected to become linear in the corrected image and then say: "Ok that will do". On the other hand I'd also be way more arrogant and say that I would never have any problems with motion tracking or any other image analysis with fish-eye images in the first place...
Hope this clarifies your confusion.

Sign in to comment.


Image Analyst
Image Analyst on 20 Oct 2017
  1 Comment
Aishwarya Patil
Aishwarya Patil on 1 Nov 2017
Hello, I applied your code, and the when i was changing the correction factor i am not the getting the corrected output istead im getting the cropped image.I am changing distortion parameters from 1/2 to 3/4 and getting the same output as input and when i increase it to 2 my image gets cropped. Can you please help me with the implementation of the code and how to find the proper output with my input image.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!