matlab分割背景与物体 - 豆芽的博客
[name,path]=uigetfile(\'*.jpg;*.png;*.bmp\',\'选择一张图片\');
f=imread([path name]);
count = 0;
T = mean2(f);
done = false;
while ~done
countcount = count + 1;
g = f > T;
Tnext = 0.5*(mean(f(g)) + mean(f(~g)));
done = abs(T - Tnext) < 0.5;
T = Tnext;
end
g = im2bw(f, T/255);
subplot(121);
imshow(f)
subplot(122);
imshow(g);
posted on 2015-01-21 20:16 豆芽的博客 阅读(1523) 评论(0) 编辑收藏举报
- 上一篇 »博客园标题背景HTML样式设置,CSS
- 下一篇 »opencv,python 图像分割