2017-07-01 11 views
0

私はmatlabを初めて使用しています。実際に私は網膜血管セグメンテーションを行う必要があります。私は、分割のためにクラスタリングを使用しましたが、結果は満足のいくものではありません。今私はファジーCのクラスタリング手法を試してみたい。しかし、私はこの目的のために関数を組み込んだmatlabを使う方法を見つけることができません。これについて私に案内してください。私は次のページに進みましたが、私はこれを私のイメージにどのように適用するのか理解できません。matlabのfcm関数を使って画像の分割を行う方法は?

https://cn.mathworks.com/help/fuzzy/fcm.html おかげ

答えて

1

最小限の作業例:

% 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) 
+0

Moesinger〜私の質問はあなたにダムかもしれないが、なぜあなたが使用しています。ここで〜を使う目的は何ですか? matlabのドキュメントでは「[centers、U] = fcm(data、Nc)」と書かれています。また、私はエラーが発生しています。比較する2つの行列と2つの出力引数を持つMAX MAXを使用するとエラーが発生します。 血液の異常(ライン18) [〜、ラベル] = max(U、1); max()が1つの入力引数を受け付けるため、このエラーが発生していることがわかります。このエラーを解決して、最も可能性の高いクラスタを得る方法。 –

+0

@sidraAleem '〜'は、未使用の変数の作成を避けるために、関数の特定の出力を無視します。この状況では、これは「U」のみに興味があり、クラスタセンターを必要としないために行われます。 https://ch.mathworks.com/help/matlab/matlab_prog/ignore-function-outputs.htmlを参照してください。「max()」エラーについて:私の間違いは、それを指摘している誤植です。一定。 –

関連する問題