重心位置の座標を表示したいのですが、どうやって組み合わせればいいのかわかりません
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167435/image.jpeg)
BW = imread('k.jpg');
BW2=rgb2gray(BW)>0;
%regionprops を使用してイメージ内の連結要素の重心を計算します。
s = regionprops(BW2,'centroid');
%各重心位置計算されたエリアの面積
Areas = regionprops(BW2,'Area');
%重心を格納する構造体配列を単一の行列に連結します。
centroids = cat(1, s.Centroid);
centroids2 = cat(1, Areas.Area);
centroids(:,3) = centroids2;
length(centroids)
j=1;
for i=1:length(centroids)
if (centroids(i,3)>1000 && centroids(i,3)<10000)
medaka_index = i;
end
end
% 重心の位置を重ね合わせたバイナリ イメージを表示します。
imshow(BW)
hold on
plot(centroids(medaka_index,1),centroids(medaka_index,2), 'b*')
hold off
ソースコードはこれです。どうすればよいのでしょうか?
2 commentaires
Takuji Fukumoto
le 8 Déc 2017
重心にプロットまではできているようですが、 「座標を表示したい」とは何を指していますかね?
1.座標を数値で画像上に表示させたい
2.Plotでの表示でなく、画像データの中にマークを入れ込みたい
などいくつか考えられるかと思いますが、 具体的に何ができていないのかを教えていただけますか?
Réponses (0)
Voir également
Catégories
En savoir plus sur イメージのセグメンテーションと解析 dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!