Effacer les filtres
Effacer les filtres

重心位置の座標を表示​したいのですが、どう​やって組み合わせれば​いいのかわかりません

36 vues (au cours des 30 derniers jours)
Takuya Nagai
Takuya Nagai le 8 Déc 2017
Commenté : Takuya Nagai le 12 Déc 2017
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
Takuji Fukumoto le 8 Déc 2017
重心にプロットまではできているようですが、 「座標を表示したい」とは何を指していますかね?
1.座標を数値で画像上に表示させたい
2.Plotでの表示でなく、画像データの中にマークを入れ込みたい
などいくつか考えられるかと思いますが、 具体的に何ができていないのかを教えていただけますか?
Takuya Nagai
Takuya Nagai le 12 Déc 2017
すみません!解決しました!

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!