Page 1 of 1

possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-25T15:29:58-07:00
by fmw42
It would appear that since IM 6.8.4.0, -edge has not respected the size argument, when -edge was replaced by the morphologic equivalent

This does not work after 6.8.3.9. The edge is 1 pixel no matter what size

convert -size 100x100 xc:white -gravity center -background black -extent 200x200 -edge 10 x:

Likewise

convert -size 100x100 xc:black -gravity center -background white -extent 200x200 -edge 10 x:

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-25T16:54:23-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-2 Beta available by sometime tomorrow. Thanks.

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-26T14:06:03-07:00
by fmw42
Testing in 6.8.5.2 Q16 Mac OSX Snow Leopard.

The following command is not producing an edge at all. I get a white square inside a black background, as if -edge 10 was not in the command.

convert -size 100x100 xc:white -gravity center -background black -extent 200x200 -edge 10 x:

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-26T16:03:21-07:00
by magick
Best we can tell, large values for the edge radius causes the kernel neighborhood pixels to have a negligible effect. The standard 3x3 edge kernel looks like this:

Code: Select all

-1 -1 -1
-1  8 -1
-1 -1 -1
For a radius of 10, we get a 21x21 kernel. Use -define showkernel=1 to see the resulting kernel values.

If you have a better kernel for edge detection, let us know.

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-26T16:52:54-07:00
by fmw42
Looking at the old -edge code from IM 6.7.4.10, it looks like you create a kernel of all -1 except the middle which is the negative of the sum of all the -1. If you are using Anthony's -morphology convolve to do the same, then I believe the issue is that you are either using his auto-normalizion, or not using the correct width. From the old code,

width=GetOptimalKernelWidth1D(radius,0.5);

So in the older code, lets say radius=2 so width=2*radius+1=5

So as test, the following seems to match well.


im67410 convert logo: -edge 2 1edge2_67410.gif
Image

convert logo: -morphology Convolve "5x5: \
-1 -1 -1 -1 -1 \
-1 -1 -1 -1 -1 \
-1 -1 24 -1 -1 \
-1 -1 -1 -1 -1 \
-1 -1 -1 -1 -1 " \
1edge5_convol_6851b.gif
Image

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-26T17:24:15-07:00
by magick
We'll get a patch into ImageMagick 6.8.5-3 Beta by sometime tomorrow. Thanks.

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-26T17:56:08-07:00
by fmw42
See my corrected post above that explains the issue and how to correct it.

Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Posted: 2013-04-27T22:44:53-07:00
by fmw42
Edge is working correctly in 6.8.5.4 beta

Tests:

1) binary square with edge 10

Beta correct
imb convert -size 100x100 xc:white -gravity center -background black -extent 200x200 -edge 10 1square_6854beta.jpg
Image

67410 correct
im67410 convert -size 100x100 xc:white -gravity center -background black -extent 200x200 -edge 10 1square_67410.jpg
Image

6845 incorrect
im6845 convert -size 100x100 xc:white -gravity center -background black -extent 200x200 -edge 10 1square_6845.jpg
Image


2) logo with edge 2

beta correct
imb convert logo: -edge 2 1logo_6854beta.jpg
Image

67410 correct
im67410 convert logo: -edge 2 1logo_67410.jpg
Image

6845 incorrect
im6845 convert logo: -edge 2 1logo_6845.jpg
Image

6839 incorrect
im6839 convert logo: -edge 2 1logo_6839.jpg
Image

6819 incorrect
im6819 convert logo: -edge 2 1logo_6819.jpg
Image