What is the best way to find an accurate threshold value for im2bw?

1 回表示 (過去 30 日間)
Nathan Costin
Nathan Costin 2016 年 7 月 18 日
コメント済み: Nathan Costin 2016 年 7 月 18 日
I have been attempting to find the best way to threshold an image for the im2bw function however any method I have attempted has resulted in failure. Most recently this has involved plotting a histogram of each colour and depending on where the noise is, using an if loop to remove that noise. The code below demonstrates how I have done this. Does anyone know of a better method so I can accurately find the threshold limit?
if sum(lower_values_red) < sum(higher_values_red) %this loop will decide what part of the histogram to remove
red_lower_limit = double(mean(r(:))) - double(std(double(r(:))));
red_upper_limit = red_realogram.BinLimits(2);
else
sum(lower_values_red) > sum(higher_values_red);
red_lower_limit = red_realogram.BinLimits(1);
red_upper_limit = double(mean(r(:))) + double(std(double(r(:))));
end
red_thresh = red_lower_limit/red_upper_limit;

回答 (1 件)

Thorsten
Thorsten 2016 年 7 月 18 日
Steve's blog may help: http://blogs.mathworks.com/steve/

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by