When you use graythresh in Matlab it obtains a value that is a normalized between 0 to 1, so when you use a threshold for something else such as imextendedmax or im2bw how would you use graythresh? I guess you have to probably multiply it by something but what?
A:
Either normalize your image to range between 0 and 1, or multiply the threshold by the maximum possible value of the image.
Dima
2010-05-06 19:22:36
A:
You need to normalize your image to [0...1] in order to use graythresh
.
%# test image
img = randn(512);
img(200:end,100:end) = img(200:end,100:end) + 5;
%# normalize. Subtract minimum to make lowest intensity equal to 0, then divide by the maximum
offset = min(img(:));
img = img - offset;
mult = max(img(:));
img = img./mult;
%# apply graythresh
th = graythresh(img);
%# if you want to know the threshold relative to the original intensities, use mult and offset like this
oriThresh = th*mult+offset;
Jonas
2010-05-06 19:31:01