Page 1 of 1

How to use sobel's edge detect in both direction (urgent)

Posted: 2010-05-05T02:51:33-07:00
by cherry
I would like to extract feature. How to use sobel's edge detection algorithm in both direction horizontal and vertical in command line. I use -convolve -1,0,1,-2,0,2,-1,0,1 function but it's seem cannot detect edge properly.

Please suggest me in urgent .

Re: How to use sobel's edge detect in both direction (urgent

Posted: 2010-05-05T10:00:58-07:00
by fmw42
if you are not using HDRI IM, then you need to add -bias and then -solarize and -level. see viewtopic.php?f=1&t=14491&hilit=sobel#p50361

also see http://www.imagemagick.org/Usage/morpho ... olve_other

Original:
Image

DX:
convert zelda3.jpg -bias 50% -convolve "-1,0,1,-2,0,2,-1,0,1" -solarize 50% -level 50,0% zelda3_dx.jpg
Image

DY:
convert zelda3.jpg -bias 50% -convolve "-1,-2,-1,0,0,0,1,2,1" -solarize 50% -level 50,0% zelda3_dy.jpg
Image


Gradient:
convert zelda3.jpg \
\( -clone 0 -bias 50% -convolve "-1,0,1,-2,0,2,-1,0,1" \
-solarize 50% -level 50,0% \) \
\( -clone 0 -bias 50% -convolve "-1,-2,-1,0,0,0,1,2,1" \
-solarize 50% -level 50,0% \) \
-delete 0 -compose plus -composite zelda3_grad.jpg
Image


see also my gradient script (with option -v 2)