possible bug with -motion-blur in IM 6.4.0-10
Posted: 2008-04-25T15:46:03-07:00
Hi,
For my testing of the FFT routines, I have been trying to deblur an image that has been blurred by motion blur. The definition of "ideal" motion blur in the spatial domain is a convolution with a 1D uniform weight filter. (See http://www.jhlabs.com/ip/blurring.html for interesting blurring java applet). Thus for a horizontal motion blur that is 15 pixels wide, that would be a kernel of "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1". Visually that would be a 15x1 white line, which if inserted into a black background would look as follows:
I took the following image (white square in a black backround):
and applied a motion blur to it in IM, ImageJ, Photoshop and GraphicConverter. Then I made the profile of the middle
row of the blurred image. As the filter has constant weight and the image is a constant white square in a black background, I would expect the profile to ramp LINEARLY from black to white on the left and right side. Here are my results:
Photoshop (motion blur filter)
ImageJ (1D convolution)
GraphicConverter (motion blur filter)
IM (-motion-blur)
It seems to me that Photoshop and ImageJ use a proper constant weight filter and GraphicConverter probably uses a gaussian weighted filter.
But I don't understand what IM is doing. I would have at least expected it to be symmetric.
Can someone check to see if this asymmetry is intended? What is the possibility that a "proper" motion blur can be implemented; or that a non-square convolution can be implemented, or both?
The issue that I see on the surface regarding IM convolution, would be to use some kind of row separator in the interface. For example a 3x3 uniform weight filter could be expressed as "1,1,1 1,1,1 1,1,1". Thus a space becomes the separator. Any other character could be used, if that is easier for you. I understand that the code underneath would likely need to be changed as well and may not be so trivial. But could this be added to the enhancements if it is not already.
For my testing of the FFT routines, I have been trying to deblur an image that has been blurred by motion blur. The definition of "ideal" motion blur in the spatial domain is a convolution with a 1D uniform weight filter. (See http://www.jhlabs.com/ip/blurring.html for interesting blurring java applet). Thus for a horizontal motion blur that is 15 pixels wide, that would be a kernel of "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1". Visually that would be a 15x1 white line, which if inserted into a black background would look as follows:
I took the following image (white square in a black backround):
and applied a motion blur to it in IM, ImageJ, Photoshop and GraphicConverter. Then I made the profile of the middle
row of the blurred image. As the filter has constant weight and the image is a constant white square in a black background, I would expect the profile to ramp LINEARLY from black to white on the left and right side. Here are my results:
Photoshop (motion blur filter)
ImageJ (1D convolution)
GraphicConverter (motion blur filter)
IM (-motion-blur)
It seems to me that Photoshop and ImageJ use a proper constant weight filter and GraphicConverter probably uses a gaussian weighted filter.
But I don't understand what IM is doing. I would have at least expected it to be symmetric.
Can someone check to see if this asymmetry is intended? What is the possibility that a "proper" motion blur can be implemented; or that a non-square convolution can be implemented, or both?
The issue that I see on the surface regarding IM convolution, would be to use some kind of row separator in the interface. For example a 3x3 uniform weight filter could be expressed as "1,1,1 1,1,1 1,1,1". Thus a space becomes the separator. Any other character could be used, if that is easier for you. I understand that the code underneath would likely need to be changed as well and may not be so trivial. But could this be added to the enhancements if it is not already.