how to find the area

8 次查看(过去 30 天)
andhavarapu lokesh
andhavarapu lokesh 2016-12-30
评论: Star Strider 2016-12-30
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

回答(3 个)

Image Analyst
Image Analyst 2016-12-30
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:
  • 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)
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.
  1 个评论
andhavarapu lokesh
andhavarapu lokesh 2016-12-30
i want to find the volume for that i need area means what should i use please tell iam not familiar

请先登录,再进行评论。


John D'Errico
John D'Errico 2016-12-30
编辑:John D'Errico 2016-12-30
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
Star Strider 2016-12-30
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 个评论
andhavarapu lokesh
andhavarapu lokesh 2016-12-30
will the bwarea give the area of white pixels or total are including black pixels also
Star Strider
Star Strider 2016-12-30
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Denoising and Compression 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by