主成分分析を使って画像の重心を通る第1主成分軸をプロットするにはどうすればよいでしょうか?
Ältere Kommentare anzeigen
歪んだ楕円のような2値画像の重心を通る最大長の軸を得るために主成分分析を行っています.
始めに2値画像の白(=1のピクセル)のx座標をdata(:,1),y座標をdata(:,2)に記録しました.
主成分分析で,因子負荷量と主成分スコアを求めたいのですが,ここからがわかりません. ご教示いただければと存じます.
Akzeptierte Antwort
Weitere Antworten (1)
Takuji Fukumoto
am 24 Nov. 2017
pcaの利用が必須、もしくは複雑な形状であればいろいろ考える必要がありそうですが、
最大長軸が明確に見えているなら、 image Processing Toolboxにある画像解析用の関数regionpropsで 'MajorAxisLength'を読めば1行で計測が可能です。
% 楕円画像を準備
BW = imbinarize(zeros(200));
BW(100,85:115) = 1;
se = strel('disk',40,8);
BW = imdilate(BW,se);
% 画像を回転して表示
BW = imrotate(BW,45);
figure, imshow(BW)
%%2値化画像解析用の関数を使って長軸の長さと回転を測定
stats = regionprops('table',BW,'MajorAxisLength','Orientation')
1 Kommentar
Yumi Iwakami
am 29 Nov. 2017
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!