2

私はMatlabが初めてです。スケルトン画像の画像処理を行っています。bworphMatlab の関数を使用して分岐点とエンドポイントを検出しています。次に、スケルトン イメージの各枝の長さを計算します。Matlabのさまざまなオプションと、画像の長さを計算する方法は何ですか?

以下は、分岐点と終点を見つけるために使用したコードです。次に、画像内の各ブランチに移動して、その長さを決定します。

mn=bwmorph(y,'branchpoints');
[row column] = find(mn);
branchPts    = [row column];
endImg    = bwmorph(y, 'endpoints');
[row column] = find(endImg);
endPts       = [row column];
figure;imshow(y);
hold on ; 
plot(branchPts(:,2),branchPts(:,1),'rx');
hold on; plot(endPts(:,2),endPts(:,1),'*');
4

1 に答える 1

3

分岐点を取り除くと、分岐は別個の連結成分になります。それらを適用regionpropsして、目的のプロパティを取得できます

branches = y & ~mn; % set branch points to zero
branchesLabeled = bwlabel( branches, 4 ); % label connected components
sts = regionprops( branchesLabeled, 'Area', 'Perimeter' ); % extract properties
于 2013-01-17T06:39:45.787 に答える