bwarea & area, white/black ratio
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi,
Can someone please explain me what is the difference of bwarea & area.
I have an image which is black and white (after segmentation and fill) & I wish to calculate the area of an object (as I understand done by bwarea) relative to the image area (imageArea = regionprops(image_name, 'Area')), more or less calculating the white/black ratio.
Any other ideas is welcome.
Thanks.
댓글 수: 0
채택된 답변
Image Analyst
2012년 10월 3일
편집: Image Analyst
2012년 10월 3일
They use different algorithms. regionprops gives the number of pixels while bwarea gives some kind of weighted area that depends on the shape of the boundary. This is described in the documentation for bwarea
The white to black ratio is
totalPixels = numel(binaryImages);
numWhitePixels = sum(binaryImage(:));
numBlackPixels = totalPixels - numWhitePixels;
ratio = numWhitePixels / numBlackPixels;
댓글 수: 0
추가 답변 (1개)
dan kin
2012년 10월 3일
댓글 수: 3
shivam sahil
2017년 12월 21일
Hey! I want to implement the same code for RGB to get pixel count of particular rgb index, please guide me with the code for the same.
Image Analyst
2017년 12월 22일
See attached demo. Also see the function colorcloud().
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!