- Patterns with zero on pixels (area = 0)
- Patterns with one on pixel (area = 1/4)
- Patterns with two adjacent on pixels (area = 1/2)
- Patterns with two diagonal on pixels (area = 3/4)
- Patterns with three on pixels (area = 7/8)
- Patterns with all four on pixels (area = 1)
how to find the area
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
iam trying to find the area of circular ring which is short axis image of myocardial spect image where i want to find the volume of the white area can any one tell how to find the area what happens if we use bwarea command in matlab
0 commentaires
Réponses (3)
Image Analyst
le 30 Déc 2016
bwarea() does NOT give the same area as a simple count of pixels, like sum() and regionprops() give you. It weights the edge pixels according to their neighbors, so like an edge slanted at 45 degrees might give half a pixel instead of a full pixel. There are different weights for different edge orientations. The bwarea documentation explains it all.
bwarea estimates the area of all of the on pixels in an image by summing the areas of each pixel in the image. The area of an individual pixel is determined by looking at its 2-by-2 neighborhood. There are six different patterns, each representing a different area:
Keep in mind that each pixel is part of four different 2-by-2 neighborhoods. This means, for example, that a single on pixel surrounded by off pixels has a total area of 1.
You have to decide if you want that or if you want a simple count of pixels.
John D'Errico
le 30 Déc 2016
Modifié(e) : John D'Errico
le 30 Déc 2016
Why not apply common sense? Count the number of white pixels. If you have some tiny amount of white pixels that are not connected to the main region of interest, then remove them first.
Since this is a black and white image, then 1 is white, 0 is black.
sum(double(im(:)))
Since each pixel has an "area" of 1, then the sum is just the area you want.
Star Strider
le 30 Déc 2016
Your ‘.png’ image may be ‘binarised’, but it contains 3 channels. Choose one of them to use with bwarea:
[Img,Map] = imread('andhavarapu lokesh Capture9.png');
MyocardArea = bwarea(Img(:,:,1));
figure(1)
for k1 = 1:3
subplot(1,3,k1)
imshow(Img(:,:,k1))
end
MyocardArea =
20899
2 commentaires
Star Strider
le 30 Déc 2016
The bwarea function calculates the area of each pixel in a 2-by-2 neighborhood, according to the documentation.
If you just want the numbers of white and black pixels with a threshold of 1 for your image, see if this does what you want:
Imgv = reshape(Img(:,:,1), [], 1);
Black_pxl = sum(Imgv == 0)
White_pxl = numel(Imgv)-Black_pxl
MyocardArea = bwarea(Img(:,:,1))
Black_pxl =
106923
White_pxl =
20871
MyocardArea =
20899
This is a rather simple way of calculating it, but may give you what you want.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!