calculate the enclosed area within an image
6 ビュー (過去 30 日間)
古いコメントを表示
I have a set of experiment images and need to analyse base on that.
with image, I have to calculate the area that are enclosed, which is 1 and 2, and neglect the area of 3,4 as it touches the boundary.
So is there way find the black area that touches the boundary?
Here is what I have done so far.
I am thinking of finding a area of 3 and 4 by setting a condition and subtract them from total black area (1,2,3,4).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Area calculation%
a=imread ('rose.jpg'); % read image
b= reb2gray (a); %chagne to gray image
c= im2bw(b) % change to black and white image
total = bwarea(c)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0 件のコメント
採用された回答
Image Analyst
2014 年 8 月 29 日
Not quite. You have to invert c and call imclearborder
regions1and2 = imclearborder(~c);
area = bwarea(regions1and2); % or sum(regions1and2(:)) - slightly different calculation.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!