Fisheye effect

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Fisheye effect

Post by dognose »

I'm trying to convert a regular image to one that looks like it's been taken with a fisheye lense.

Image

does anyone have any ideas on how I'd do the distortion of an image necessary for this?

I'm looking for something more realistic than just the explode option.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye effect

Post by fmw42 »

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Fisheye effect

Post by anthony »

A reversed -implode will do this, but only if you limit it to a value less than 2. A value more that 2 exhibits infinities into the formula that results in artificial effects.

It is not exactly a fish eye distortion, and you may need to enlarge the image (add a temporary border) to expand the outside radius, to get what you want.

Also the pixel lookup is just interpolative, so parts of an image that is compressed by more than 50% will start have aliasing effects, (unless a super-sampling tenchnique is used to improve results). That will remain the case until I improve the general -distort function and migrate circular distorts to it (no time line for this, due to other commitments and a china trip in April).

If you must have a better fish eye distortion, look at the DIY distostion methods using the -fx operator.
http://imagemagick.org/Usage/distorts/a ... affine_diy
And the use of pre-calculated distortion maps for handling multiple images with the same distortion parameters.
http://imagemagick.org/Usage/distorts/#lut

Please let us know how you get on, the method/path you finally take, and hopefully some examples and results of what you achieve.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye effect

Post by fmw42 »

You can now do something like this with my new pinbarrel script that allow you to apply barrel or pincushion distortion to an image with an arbitrary center point. See

http://www.fmwconcepts.com/imagemagick/index.html

I am trying to do a proper fisheye distortion, which maps the whole image into a circle (actually onto a hemisphere). What you have in your image is more a wide angle, not a true fisheye, I think.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Fisheye effect

Post by fmw42 »

You can now do something like this with my new bubblewarp script that allows you to apply warp an image onto a hemisphere. It is not the same as a true 180 degree field of view fisheye effect, but similar.

http://www.fmwconcepts.com/imagemagick/index.html

I hope to do a proper fisheye distortion, but have not quite gotten around to it.
Post Reply