possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

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.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard

Post 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:
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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:
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Last edited by fmw42 on 2013-04-26T17:57:31-07:00, edited 3 times in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

We'll get a patch into ImageMagick 6.8.5-3 Beta by sometime tomorrow. Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 »

See my corrected post above that explains the issue and how to correct it.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Post Reply