Page 1 of 1

horizontal and vertical blur?

Posted: 2008-05-09T07:06:36-07:00
by jnimo
hi, sorry if i'm asking to much this days.


i have already solve the problem of make a pdf in multiple steps :D this is a really fun lib :D

i have another question, there is a way to make a horizontal blur and a vertical blur?, i mean the -blur make a blur but from center, i want to make a left to right blur, or a up to down blur.


Thanks for reading, and thanks for the solution

Re: horizontal and vertical blur?

Posted: 2008-05-09T11:57:11-07:00
by fmw42
-motion-blur should be what you want, but it may not be working correctly. Give it a try, but if it does not work to your satisfaction then you need to compose a filter using -convolve. Here is an example of a horizontal blur 15 pixels wide:

filt15="\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
"
convert inputimage -convolve $filt15 outputimage

Re: horizontal and vertical blur?

Posted: 2008-05-10T02:37:28-07:00
by jnimo
i try to make that command but it give me a malloc problem


convert prueba.jpg_2 -convolve $filt15 salida.jpg
*** glibc detected *** convert: malloc(): memory corruption: 0x08207a70 ***


i don't know what could be

Re: horizontal and vertical blur?

Posted: 2008-05-10T13:04:10-07:00
by fmw42
I am not sure. You may not have enough memory? But try taking out all the backslashes and make the filt15 variable definition all one long line. Be sure not to remove any commas or the quotes.

If you are on Windows, you may need to use double backslashes \\ (escape the backslash as that is a special character on Windows) or remove them.

Re: horizontal and vertical blur?

Posted: 2008-05-10T13:51:39-07:00
by Bonzo
Not quite sure what the effect is supposed to be but this created an image for me using php on a windows XP machine.

Code: Select all

<?php

$filt15 = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,";
exec("convert print2.jpg -convolve $filt15 blur.png");

?>
The original post didn't work neither did changing the \ to \\

Re: horizontal and vertical blur?

Posted: 2008-05-10T18:24:48-07:00
by fmw42
It is supposed to create the equivalent of a 1D horizontal blur of 15 pixels using a uniform convolution kernel. IM -convolve cannot handle 1D, non-square or even kernels. This is the equivalent of a proper motion blur as a camera would see it. IM has -motion-blur, but it is not symmetric nor does it have uniform weights, but is 1D.

The filter as I created it with the continuation backslashes works fine in Unix. But I am afraid that \ is not a continuation character in Windows. Thus the need to remove them all.

Even though IM -convolve requires square filters, they have to be expressed as one long comma delimited string. The \ for continuation was just a convenience to make it look like it is 2D.

Re: horizontal and vertical blur?

Posted: 2008-05-26T23:29:52-07:00
by anthony
If you don't mind it being exact.

Do two motion blurs, one in each direction, and then average those two images together. I do this for creating 'star' rays in
http://imagemagick.org/Usage/advanced/#stars
Though I repeat it at multiple angles.