/ / como fazer segmentação de imagem usando a função fcm incorporada no matlab? - matlab, segmentação de imagem

como fazer segmentação de imagem usando construído em função fcm em matlab? - matlab, segmentação de imagem

Eu sou novo no matlab. Na verdade eu tenho que fazer a segmentação dos vasos sanguíneos da retina. Eu usei clustering kmeans para segmentação, mas o resultado não é satisfatório. Agora eu quero experimentar fuzzy c significa técnica de clustering. No entanto, não sou capaz de descobrir como usar o matlab incorporado em função para este propósito. Por favor me guie sobre isso. Eu passei pela página seguinte, mas não consigo entender como aplicar tudo isso à minha imagem.

https://cn.mathworks.com/help/fuzzy/fcm.html obrigado

Respostas:

1 para resposta № 1

Um exemplo de trabalho mínimo:

% some sample rgb image
MyImage = imread("autumn.tif");
% display it
figure; imshow(MyImage)
% size of the image
sz = size(MyImage);
% reshape the image to column format (each color band into one column). I guess you
%also did this for the k-means. If not that"s why you did get poor results.
ImageInColumnFormat = reshape(MyImage,[],sz(3));
% number of clusters you want
NumberOfClusters = 4;
% U shows how likely each pixel belongs to each cluster.
% double() is only necessary because the sample image is uint8 and fcm has trouble with that format. You may not have to do that.
[~,U] = fcm(double(ImageInColumnFormat),NumberOfClusters);
% Get for each pixel the most likely cluster
[~,Labels] = max(U,[],1);
% reshape it back into the image format
LabelsInImageFormat = reshape(Labels,sz(1),sz(2));
% show result
figure; imagesc(LabelsInImageFormat)