The threshold of sobel
조회 수: 6 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2013년 11월 29일
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
Image Analyst
2013년 12월 4일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!