【问题标题】:How to show segmented image?如何显示分段图像?
【发布时间】:2016-10-19 00:40:54
【问题描述】:

我有一个阈值矩阵来分割我的图像。这是多阈值分割,所有阈值都已准备好。 现在,我怎样才能显示我的分段图像? 在每个时期之间,我希望它具有相同的灰度。 这段代码是错误的,但会说出我需要的。

level = sort(thresholds);
I1 = I(0<I && I<level(1));
I1 = gray1;

I2 = (level(1)<I && I<level(2));
I2 = gray2;

这是我的想象,但我无法将其更改为 matlab 代码。 例如阈值元素的数量为 5

【问题讨论】:

  • 把&&符号改成&
  • @Ibezito 没关系,但是灰色的值呢?什么合适?

标签: matlab image-segmentation


【解决方案1】:

你的意思是这样的吗?:

% read Matlab reference image 
I=imread('coins.png');

% thresholds
gray1=100; % lower limit
gray2=200; % upper limit
I(find(I<gray1))=0; % replace anything less than gray1 with zeros
I(find(I>gray2))=0; % replace anything more than gray1 with zeros
imshow(I);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    • 2014-11-26
    • 2012-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多