回 帖 发 新 帖 刷新版面

主题:【请教】在Matlab中用平均值平均的阈值算法求灰度图的全局阈值的程序该如何设计?

在Matlab中用平均值平均的阈值算法求灰度图的全局阈值的程序该如何设计?
谢谢:P

回复列表 (共3个回复)

沙发

晕 

求图象平均值
再阈值处理

板凳

这方法要能分割图像,我就去撞豆腐了!
太落后了,^_^

3 楼

I = imread('filename.bmp');

I = double(I);

T = mean(mean(I));
[height, width] = size(I);
Ishow = zeros(height, width);    % 结果图
for i=1:height
   for j=1:width
      if I(i,j) > T
         Ishow(i,j) = 1;
      else
         Ishow(i,j) = 0;
      end
   end
end

figure;
imshow(Ishow);

我来回复

您尚未登录,请登录后再回复。点此登录或注册