serious problems with -convolve IM 6.0.0

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: serious problems with -convolve IM 6.0.0

Post by magick »

We need to investigate further. We'll post the results sometime tomorrow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: serious problems with -convolve IM 6.0.0

Post by fmw42 »

magick wrote:We need to investigate further. We'll post the results sometime tomorrow.

I tried another grayscale image and it is getting reversed kernels also.

original:

Image

OLD:

convert zeldagc.jpg -convolve "-1.000,-1.000,-1.000,-1.000,8.000,-1.000,-1.000,-1.000,-1.000" zeldag_f3.jpg

Image


NEW:

convert zeldagc.jpg -convolve "-1.000,-1.000,-1.000,-1.000,8.000,-1.000,-1.000,-1.000,-1.000" zeldagc_f3_m100_convolve.jpg

Image

Animation:

Image


My guess is that either at some point in time the kernel values for zero sums were negated in the code. Or at some point in my development of these old scripts, I made a change to negate the values, but did not change the examples.

I am not sure which without actually going back to some very old release, but I don't know what release I used when these were developed.

If you would double check to be sure there is no change of sign for zero sum kernels (perhaps due to Anthony's changes), I would appreciate it.

But if that is not the case, then I will assume it was my inconsistency and live with it as it is. Other than this, I think it is working correctly now.

I will try tomorrow to come up with a better test image that might distinguish whether there is a reversal or not for these zero sum edge images. Perhaps looking at the biased case might shed some light on the issue. I will get back to you.

Thanks for all your help and attention to this issue.

Fred
Last edited by fmw42 on 2010-03-05T22:20:13-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: serious problems with -convolve IM 6.0.0

Post by fmw42 »

Here is a new test case:

original image:

Image


convert circletest.png -convolve "-1,-1,-1,-1,8,-1,-1,-1,-1" circletest_lap3_a.png

Image

convert circletest.png -convolve "1,1,1,1,-8,1,1,1,1" circletest_lap3_b.png

Image

From the above, I think the results for no bias are correct. This is because we have in the first case only one set of positive values giving the white ring and the two sets of negatives which would produce two dark rings will be clipped to black. In the second case, we have two sets of positive values (offset by one pixel) and one set of negative values. Thus we should get two white rings and dark ring associated with the negative value will be clipped to black.

So I tried adding a bias of 50% so I could see both the light ring(s) and the dark ring(s), BUT I am not getting any bias. Is this another bug?

convert circletest.png -bias 50% -convolve "-1,-1,-1,-1,8,-1,-1,-1,-1" circletest_lap3_bias50_a.png

Image

convert circletest.png -bias 50% -convolve "1,1,1,1,-8,1,1,1,1" circletest_lap3_bias50_b.png

Image

With a bias of 50%, should not the background be gray and not black?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: serious problems with -convolve IM 6.0.0

Post by magick »

We patched the bias problem. Convolve appears to be producing correct results. That is, we're running an older version of ImageMagick along with the new version and using a compare -metric rmse and get the expected 0DB. We'll continue testing today to see if we can produce any differences between the versions.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: serious problems with -convolve IM 6.0.0

Post by fmw42 »

magick wrote:We patched the bias problem. Convolve appears to be producing correct results. That is, we're running an older version of ImageMagick along with the new version and using a compare -metric rmse and get the expected 0DB. We'll continue testing today to see if we can produce any differences between the versions.
Yes, the biases are now working. Here are the last two bias tests, which I believe are working correctly, now.

Image

convert circletest.png -bias 50% -convolve "-1,-1,-1,-1,8,-1,-1,-1,-1" circletest_lap3_bias50_a2.png

Image

convert circletest.png -bias 50% -convolve "1,1,1,1,-8,1,1,1,1" circletest_lap3_bias50_b2.png

Image


I believe that -convolve is now working correctly as it used to.

I think the inconsistency I was having with the sign reversal can be attributed to my laplacian script. Mathematically, the laplacian should have a negative central lobe. But, I have a recollection now that I reversed the sign (inverted the laplacian) at some point (to be consistent with what most others do for the laplacian), but I guess I did not go back to change my original examples. The sign reversal issue was only a problem with the laplacian script. That is why the other example from my binomial script worked correctly with no sign reversal.

Sorry for the confusion and extra work on your part.

I am grateful for your dedication in getting -convolve fixed so quickly (it fixed about a dozen of my scripts) and apologize for taking you away from other things you were working on.

Thanks.

Fred
Post Reply