Sobel Edge Thresholds
41 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
David Young
2011 年 12 月 9 日
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.
回答 (3 件)
Sean de Wolski
2011 年 12 月 9 日
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 件のコメント
David Young
2011 年 12 月 10 日
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 件のコメント
Image Analyst
2013 年 1 月 23 日
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
2013 年 1 月 22 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!