how to find the area of black region in image....?
2 次查看(过去 30 天)
显示 更早的评论
I have to find the blank area in the image...ie its value is 0..how to find the area..help me out...
0 个评论
回答(3 个)
Andrei Bobrov
2012-5-15
s = regionprops(YourImage == 0,'Area','PixelIdxList')
add
I = imread('44298455.png');
i0 = im2bw(I,graythresh(I));
s = regionprops(i0 == 0,'Area','PixelIdxList')
4 个评论
Walter Roberson
2012-5-15
sum(YourImage(:) == 0)
2 个评论
Walter Roberson
2012-5-15
Are there parts of the image which contain blank areas that you do _not_ wish to have included? The code I gave does not give the area of the whole image, only of the blank area.
Image Analyst
2012-5-15
Try this:
binaryImage = grayScaleImage == 0;
measurements = regionprops(binaryImage, 'Area');
allAreas = [measurements.Area]
allAreas will be an array of areas. Each physically separated, isolated, black region will have its own area in the array.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!