How to get the threshold value from Otsu's method?
8 views (last 30 days)
Show older comments
According to their documentation, they both calculate the threshold value by using Otsu's method.
I tried this with the coins.png image:
using otsuthresh function:
img = imread('coins.png');
[counts,x] = imhist(img,16);
stem(x,counts);
T = otsuthresh(counts);
BW = imbinarize(imgNorm,T);
subplot(1,2,1)
imshow(img); title('original image');
subplot(1,2,2)
imshow(BW); title('binary image');
T = 0.467
using graythresh function:
img = imread('coins.png');
T = graythresh(img);
BW = imbinarize(img,T);
subplot(1,2,1)
imshow(img); title('original image');
subplot(1,2,2)
imshow(BW); title('binary image');
T = 0.494
I have two questions:
- What is the difference between these two thresholds? and which one refers to global thresholding method?
- How can I get the gray-level value at the threshold? (where is the threshold at the horizontal axis in the histogram?)
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!