【问题标题】:How to apply Matlab Fuzzy C-means (fcm) output for image segmentation如何应用 Matlab 模糊 C 均值 (fcm) 输出进行图像分割
【发布时间】:2017-08-28 06:36:05
【问题描述】:

我有一个 2D 灰度图像(= 数据),我正在尝试使用 fcm.m 对其进行分割:

Nc=2; %number of clusters is 2

[centers,U] = fcm(data,Nc);

如何应用 fcm.m 的输出来分割原始图像。我在网上找不到工作示例。

【问题讨论】:

    标签: matlab fuzzy-c-means


    【解决方案1】:

    只要reshape:

    img = im2double(imread('cameraman.tif'));
    Nc = 2; %number of clusters is 2
    
    [centers,U] = fcm(img(:),Nc);
    subplot(121);
    imshow(reshape(U(1,:),size(img)),[])
    title('fuzzy membership for class 1')
    colorbar()
    subplot(122);
    [~,I] = max(U,[],1);
    imshow(reshape(I,size(img)),[])
    title('hard membership')
    colorbar()
    

    【讨论】:

      猜你喜欢
      • 2012-03-19
      • 2021-11-01
      • 2012-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      相关资源
      最近更新 更多