How to make a seamless barrel (fisheye lens) or pincushion distortion
15 views (last 30 days)
Show older comments
Hi, I have undistorted grayscale images and wish to distort them locally with barrel (fisheye) or pincushion distortions. It is important that the 'edges' of the lens are not seen, i.e. I want to manipulate the distortion function, not work with masking or so to merge images . I have seen answers here relating how to apply the distortion in general, but it warps the entire picture.
related thread: http://stackoverflow.com/questions/2589851/how-can-i-implement-this-visual-effect-in-matlab the function fisheye_inverse is already quite nice but I'm not sure how to manipulate the position of the effect, and its overall size or direction.
See the link for a successful example from another software.
0 Comments
Answers (1)
Image Analyst
on 6 Jan 2014
Edited: Image Analyst
on 6 Jan 2014
That code looks wrong to me. But it does give a similar effect. I don't think it was developed by someone with a Ph.D. in optics, like I have. If you want a true barrel or pincushion aberration simulated, you don't scale the location of the point by the square of the distance to the optic axis like they did, though that might seem reasonable to someone who hasn't taken a course in lens design. The actual formula , for a real optical system at the lowest order, says that the distance the point moves , from its "perfect" position, is proportional to the cube of the distance of the perfect point from the origin (optic axis). In other word not rNew = a*rOld^2 like they did, but rNew = rOld + a*rOld^3 or rNew = rOld(1+arOld^2), where r means radius from the optic axis, which is not the same formula as your links used.
2 Comments
Image Analyst
on 7 Apr 2014
See this link where I've given some code: http://www.mathworks.com/matlabcentral/answers/124324#answer_131969
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!