serious problems with -convolve IM 6.0.0
Posted: 2010-03-04T19:57:39-07:00
I was just notified by a user of my binomial script that it is not working in IM 6.5.9 or 6.0.0 (and probably changed between 6.5.9.0 and 6.5.9.5). So I tested it under IM 6.0.0.-1 Q16 Mac OSX and find the results are completely different from what they used to be. (see my examples at http://www.fmwconcepts.com/imagemagick/ ... /index.php)
My binomial script makes use of -convolve. I suspect that Anthony has folded in his changes from -morphology with perhaps some strange automatic normalization, in this case when I have both positive and negative weight that do not add to 0. The filter is symmetric so a change from correlation (which it used to do) to true convolution, which is a 180 deg rotate of the kernel, should not matter.
Here are the old results for 50% mix of the image with a binomial high pass filtered image along with the convolution kernels.
The forumula I used in my script to compute the kernel is:
f = s*i - m*b for the high pass filter kernel, where s is the sum of the weights for the un-normalized binomial kernel b and m is a mixing fraction between 0 and 1 (or in percent 0 to 100 percent as used in the script)
So in the case below:
Here is one example of running binomial and the IM convolve kernels the way it used to work.
original image:
binomial -t high -m 50 -w 3 lena3.jpg lena3_high_m50_w3.jpg
2D (Un-Normalized) Binomial Kernel
1 2 1
2 4 2
1 2 1
2D Final Kernel
-.500 -1.000 -.500
-1.000 14.000 -1.000
-.500 -1.000 -.500
IM Final Kernel
-.500,-1.000,-.500,-1.000,14.000,-1.000,-.500,-1.000,-.500
Here is the same thing with bad results now in IM 6.0.0.-1
original image:
Here is one example of running binomial and the IM convolve kernels the way it used to work.
binomial -t high -m 50 -w 3 lena2.jpg lena2_thi_m50_w3.jpg
2D (Un-Normalized) Binomial Kernel
1 2 1
2 4 2
1 2 1
2D Final Kernel
-.750 -1.500 -.750
-1.500 13.000 -1.500
-.750 -1.500 -.750
IM Final Kernel
-.750,-1.500,-.750,-1.500,13.000,-1.500,-.750,-1.500,-.750
Which is the same result now as running:
convert lena2.jpg -convolve "-.500,-1.000,-.500,-1.000,14.000,-1.000,-.500,-1.000,-.500" lena2_binomial_m50.jpg
Anthony, please help. Let me know what changes have been made or if this is just a bug. I have numerous scripts that use -convolve and I really did not want to change them all. Many, if not all, are broken now.
Fred
My binomial script makes use of -convolve. I suspect that Anthony has folded in his changes from -morphology with perhaps some strange automatic normalization, in this case when I have both positive and negative weight that do not add to 0. The filter is symmetric so a change from correlation (which it used to do) to true convolution, which is a 180 deg rotate of the kernel, should not matter.
Here are the old results for 50% mix of the image with a binomial high pass filtered image along with the convolution kernels.
The forumula I used in my script to compute the kernel is:
f = s*i - m*b for the high pass filter kernel, where s is the sum of the weights for the un-normalized binomial kernel b and m is a mixing fraction between 0 and 1 (or in percent 0 to 100 percent as used in the script)
So in the case below:
Code: Select all
f= 16* 0 0 0 - .5* 1 2 1 = 0 0 0 - 0.5 1 0.5 = -0.5 -1 -0.5
0 1 0 2 4 2 0 16 0 1 2 1 -1 14 -1
0 0 0 1 2 1 0 0 0 0.5 1 0.5 -0.5 -1 -0.5
original image:
binomial -t high -m 50 -w 3 lena3.jpg lena3_high_m50_w3.jpg
2D (Un-Normalized) Binomial Kernel
1 2 1
2 4 2
1 2 1
2D Final Kernel
-.500 -1.000 -.500
-1.000 14.000 -1.000
-.500 -1.000 -.500
IM Final Kernel
-.500,-1.000,-.500,-1.000,14.000,-1.000,-.500,-1.000,-.500
Here is the same thing with bad results now in IM 6.0.0.-1
original image:
Here is one example of running binomial and the IM convolve kernels the way it used to work.
binomial -t high -m 50 -w 3 lena2.jpg lena2_thi_m50_w3.jpg
2D (Un-Normalized) Binomial Kernel
1 2 1
2 4 2
1 2 1
2D Final Kernel
-.750 -1.500 -.750
-1.500 13.000 -1.500
-.750 -1.500 -.750
IM Final Kernel
-.750,-1.500,-.750,-1.500,13.000,-1.500,-.750,-1.500,-.750
Which is the same result now as running:
convert lena2.jpg -convolve "-.500,-1.000,-.500,-1.000,14.000,-1.000,-.500,-1.000,-.500" lena2_binomial_m50.jpg
Anthony, please help. Let me know what changes have been made or if this is just a bug. I have numerous scripts that use -convolve and I really did not want to change them all. Many, if not all, are broken now.
Fred