How to find area of specific region in binary image ?
조회 수: 6 (최근 30일)
이전 댓글 표시
For example, I have image with
- region1 white,
- region2 black,
- region3 white,
- region4 black and
- region5 white.
How can I know pixel density in region4 and how to convert that specific area mm2/cm2 ?
댓글 수: 2
Image Analyst
2020년 11월 29일
What do you mean by pixel density? All regions of the image have the same density (pixels per unit area). Or do you mean "optical density", in other words, intensity of a gray scale image in region 4?
답변 (1개)
Image Analyst
2020년 11월 30일
편집: Image Analyst
2020년 11월 30일
See my Image Segmentation Tutorial in my File Exchange:
In short, segment your image by thresholding or whatever to get a mask, then do
props = regionprops(mask, grayImage, 'Area', 'MeanIntensity');
for k = 1 : numel(props)
fprintf('Blob #%d has an area of %d pixels (%.2f sq. cm), and mean intensity of %.2f\n', ...
k, props(k).Area, props(k).Area * cmPerPixel^2, props(k).MeanIntensity);
end
To see how to determine the number of pixels per cm, see my attached spatial calibration demo.
댓글 수: 6
Image Analyst
2020년 12월 1일
areaOfBlob3 = allAreas(3);
I think that's SO obvious that I'm not sure it's what you mean, so try to explain better.
참고 항목
카테고리
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!