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:
possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard
Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.5-2 Beta available by sometime tomorrow. Thanks.
- 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
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:
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
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:
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.
Code: Select all
-1 -1 -1
-1 8 -1
-1 -1 -1
If you have a better kernel for edge detection, let us know.
- 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
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

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

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

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

Last edited by fmw42 on 2013-04-26T17:57:31-07:00, edited 3 times in total.
Re: possible bug -edge 6.8.5.0 Q16 Mac OSX Snow Leopard
We'll get a patch into ImageMagick 6.8.5-3 Beta by sometime tomorrow. Thanks.
- 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
See my corrected post above that explains the issue and how to correct it.
- 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
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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