The threshold of sobel
6 views (last 30 days)
Show older comments
Hi,
I am trying to find how the sobel threshold is defined:
I found :
determine the threshold; see page 514 of "Digital Imaging Processing" by
% William K. Pratt
if isempty(thresh), % Determine cutoff based on RMS estimate of noise
% Mean of the magnitude squared image is a
% value that's roughly proportional to SNR
cutoff = scale*mean2(b);
thresh = sqrt(cutoff);
scale = 4; % for calculating the automatic threshold
So I looked in the book to find an explanation why the scale is 4? but it is not explained, the book states that the threshold can be scaled linearly with the SNR but it does not explain why scale =4. Can someone explain this? I so that there were other post around this topic but I did not find a solution to this question.
txn, regards, J
0 Comments
Accepted Answer
Image Analyst
on 29 Nov 2013
You can use imgradient() to get the full, original Sobel-filtered image. Then you can set a threshold equal to 4 or 5 or whatever you want. It doesn't matter what they did. It only matters what you need to do to get the best results for your particular images.
12 Comments
Image Analyst
on 4 Dec 2013
OK, in that case you probably do want an edge detector. But you don't want to threshold it - you want to take the mean of it. First of all you need to have a window large enough to contain your blur or else you can't tell how much it's blurred. With a 3x3 Sobel filter you can tell when it's in focus but if it's blurred a lot or a huge lot, you'll never be able to tell. So you'll probably want to use a Laplacian of Gaussian or Difference of Gaussian filter. But be aware that if the window is too large, then you'll start picking up on your shading/vignetting, and to prevent that you'll need to do a background correction (which you can do with polyfitn. So then when you have the edges you'd simply want to sum your image (or mean - basically the same thing) to get a metric that indicates how much your image is blurred. If the sum or mean is higher, there are more edges there, indicating sharper edges. I don't really see any benefit to thresholding it for the purpose of either binarizing it or masking it.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!