Sobel Edge Thresholds
39 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I would like to test several sobel edge threshold values to identify which threshold is the best suited to a particular task... However, I do not know what range of threshold values to test.
My input images are all grayscale from the range 0-255. I read on a previous answer that if the max. value is 255 and the min. value is 0, the max. gradient becomes
(1 + 2 + 1)*255 - (1 + 2 + 1)*0 = 1020.
Which means the threshold can range from -1020:1020... However, when I use a threshold as small as 0.4, the threshold seems too high because no edges are found.
I would be grateful if anyone can help me to understand the most suitable threshold range to evaluate...
2 comentarios
David Young
el 9 de Dic. de 2011
I suggest you post your code and/or your image, as something must be wrong. You are correct to think that if the image values range up to 255, then 0.4 is a very low threshold.
Respuestas (3)
Sean de Wolski
el 9 de Dic. de 2011
Have you looked at the output for
fspecial('sobel')
I would recommend using a for-loop to traverse a few values to hone in on what threshold you think is best.
0 comentarios
David Young
el 10 de Dic. de 2011
I think there are two problems here.
The first is that it's not clear exactly what the Sobel option in edge() really does, as the threshold that it returns seems much lower that is reasonable. Some kind of normalisation seems to be going on, but it's not properly documented. The gv and gh results from edge('sobel', ...) are also smaller in amplitude that I'd expect, by more than the factor of 8 shown in the documentation.
I'd address this by using my own sobel masks (you can use fspecial as Sean suggests, or you can just write them down) and then convolving with conv2, and thresholding myself.
The second problem is that the Sobel operation on its own is too small-scale for most real images - you'll likely get fragmentary edges all over. For most cases a detector that incorporates some smoothing (e.g. Canny, also available using edge()), will give more useful results.
1 comentario
Image Analyst
el 23 de En. de 2013
I agree with your second problem. A difference of Gaussians filter is more flexible than a Sobel and finds lines in all directions (if you want). Actually, I've rarely ever found Sobel useful in practical situations. Kind of like histogram equalization - something everybody learns and wants to try but ends up being useless in practice.
Guanfeng Wang
el 22 de En. de 2013
0.4 is not a very low threshold. Because in edge function, it first run a = im2single(a) to scale 0~255 values to 0~1 single precision.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!