面積を画像に表示させる方法
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
画像を読み込み、下記のような処理をしています。
画像は結晶が複数写っているようなもので、セグメント化して面積や長径を求めたいです。
①画像に重心を表示することはできるのですが、面積や長径を表示させる方法はありますか?
②regionpropsの後、Centroid等の並びにBoundingBoxを入れるとエラーが出るのですが、何故でしょうか。
初心者のため拙い説明とコードで申し訳ありませんが、ご助言頂けますと幸いです。
figure; imshow(I);
I2=rgb2gray(I);
figure; imshow(I2);
figure; imhist(I2);
%%
BW=I2<75;
figure; imshow(BW);
%%
BW=imopen(BW,strel('disk',3));
figure; imshow(BW);
%%
Iclr=imclearborder(BW);
figure; imshow(Iclr);
%%
stats=regionprops('table',Iclr,'Centroid','Area','MajorAxisLength')
idx=stats.Area>5000;
stats(idx,:)=[];
%%
figure; imshow(Iclr); hold on;
plot(stats.Centroid(:,1),stats.Centroid(:,2),'r*');
hold off;
%%
AREA=[stats.Area];
h=histogram(AREA,'BinWidth',100)
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu 領域とイメージのプロパティ finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!