Zoom Blur

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
3DTOPO
Posts: 28
Joined: 2010-07-05T16:13:53-07:00
Authentication code: 8675308

Zoom Blur

Post by 3DTOPO »

Greetings,

Can anyone recommend an approach to creating a zoom blur type filter?

The effect is similar to a motion blur, but has a center and the blur are rays from the center.

Any suggestions would be greatly appreciated!


Thank you.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Zoom Blur

Post by fmw42 »

see my zoomblur script at the link below. it iterates on zooming and blending. sorry it is a bash shell script. I don't know any of the IM APIs.

But IM now can do a variable blur, but I don't know if that is what you want. See http://www.imagemagick.org/Usage/mapping/#blur
3DTOPO
Posts: 28
Joined: 2010-07-05T16:13:53-07:00
Authentication code: 8675308

Re: Zoom Blur

Post by 3DTOPO »

Nice collection of scripts!

Do you know if it is possible to use the "convert" IM command from a C/C++ interface?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Zoom Blur

Post by fmw42 »

3DTOPO wrote:Nice collection of scripts!

Do you know if it is possible to use the "convert" IM command from a C/C++ interface?

You should be able to do the equivalent in C or C++, but some functions especially in C++ may not be fully implemented. I really don't know much for sure. But usually if something is missing, the IM folks will generally add it depending upon their time availability.

Unfortunately, you would have to take all my commands and convert them from command line format using convert to your API calls. Convert itself as far as I know does not exist per se in those APIs. But again I am not an expert on any of them.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Zoom Blur

Post by el_supremo »

In the C API there is a function, ConvertImageCommand, which takes exactly the same arguments as the command line version.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Zoom Blur

Post by fmw42 »

el_supremo wrote:In the C API there is a function, ConvertImageCommand, which takes exactly the same arguments as the command line version.

Pete
Pete,

Thanks for correcting me.

Fred
3DTOPO
Posts: 28
Joined: 2010-07-05T16:13:53-07:00
Authentication code: 8675308

Re: Zoom Blur

Post by 3DTOPO »

el_supremo wrote:In the C API there is a function, ConvertImageCommand, which takes exactly the same arguments as the command line version.

Pete
That is Excellent!

Thank you very much both Fred and Pete!
3DTOPO
Posts: 28
Joined: 2010-07-05T16:13:53-07:00
Authentication code: 8675308

Re: Zoom Blur

Post by 3DTOPO »

Hey Fred,

I was wondering if you knew of a way to get a "reverse fisheye" effect?

I tried entering negative values but they are not accepted from your script.

Example, original on the left, inverse fisheye on the right:

Image


Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Zoom Blur

Post by fmw42 »

For a reverse fisheye type distortion, try my bubblewarp script with -t sin -m polar. Note my spherize script is the same, but faster and also more limited. So right now I trap for positive warp (outward sphere) only. I suspect I could relax that if you need it.

You can also see my pinbarrel script for examples. IM now has -distort barrel, so you can do something similar with it.

PS I forgot to mention that the order of my coefficients in pinbarrel is opposite to what was used by Anthony in -distort barrel and the apparent conventional ordering. Note -distort barrelinverse is not the inverse of -distort barrel. Its results are similar, but uses inverse radial powers rather than radial powers.
3DTOPO
Posts: 28
Joined: 2010-07-05T16:13:53-07:00
Authentication code: 8675308

Re: Zoom Blur

Post by 3DTOPO »

fmw42 wrote:For a reverse fisheye type distortion, try my bubblewarp script with -t sin -m polar.
Thanks Fred!

bubblwrap -t sin from your examples looks perfect!

But I am getting identical results using sin and arcsin which both appear to be an arcsin result.

I can show my test images if it might help....
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Zoom Blur

Post by fmw42 »

bubblwrap -t sin from your examples looks perfect!

But I am getting identical results using sin and arcsin which both appear to be an arcsin result.
You found an oversight in my conversion of my test script to a formal script. I have corrected it now. You can download it from my web site or send me email (fmw at alink dot net) and I can send you the revised script.

Thanks for finding that and pointing it out. It has been there since the script was first posted and no one has commented on that.

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

Re: Zoom Blur

Post by anthony »

A new alternative for radile blurring is to use "Variable Blur Mapping".
http://www.imagemagick.org/Usage/mapping/#blur

With the right mapping file you can generate basically any type of blur effect you want.

How about a spiral blur? Or a mix of distortions (by whatever means) and blurring?

And please let us see your results (and source images) for your own mapping effects.
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: Zoom Blur

Post by fmw42 »

for reverse fisheye type distortion, try


Image

bubblewarp -t sin -m polar zelda3.jpg zelda3_bubble_sin.jpg
Image



or

convert zelda3.jpg -distort barrel "0 0 -0.5 1.5" zelda3_pincushion.jpg
Image


For radial blur, try

convert zelda3.jpg \( -size 128x128 radial-gradient: -negate \) \
-compose blur -set option:compose:args 5 -composite zelda3_radialbur_5.jpg
Image
siuying

Re: Zoom Blur

Post by siuying »

Hi,

I'm using MagickWand and based on your post i were able to create radial-blur effect using code below:

Code: Select all

	MagickWand* tWand = NewMagickWand();
	MagickSetOption(tWand, "compose:args", "5");
	MagickSetSize(tWand, w, h);
	MagickReadImage(tWand, "radial-gradient:black-white");
	MagickCompositeImage(mainWand, tWand, BlurCompositeOp, 0, 0);		
	DestroyMagickWand(tWand);
Unfortunately the result is not exactly what i wanted:

Image http://screencast.com/t/yn2wpCbF

For some reason the center part of the image is blurred, where i expect it should be 0% blur at center.

Could you see anything I'm doing wrong? Or would you have any recommendation? Thanks in advance.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Zoom Blur

Post by anthony »

The very center isn't blured. but that is only a single pixel.

If you want to make the area near the center less blurred you will need to create a blur map of some kind.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply