How can I find the sum of the area in a specified region in the image according to the pixel intensity value?
3 次查看(过去 30 天)
显示 更早的评论
Suppose two lines with theta angle are drawn from the point (1,1) in an image. Let's consider two arcs with radii of r1 and r2, which have the origin point (1,1) and intersect these lines. I want to find the sum of the area between the four of them in terms of pixels. However, arcs or lines are dividing some squares. I want to add the remaining value in the field to the total. For example, if 1/3 of a pixel is in the area and the pixel value is 120, I want to add 30 to the total. Which method should I use?
First of all, thank you for your comments. The indices of the matrix defined for an image are actually the midpoint of a pixel that we can think of as that square. The subject is a bit complicated, I don't want to go into too much detail. I can show the attached picture as an example. Let's assume that each pixel writes the intensity values inside. We will use this as a field. If we consider each pixel as a square, I need the sum of the area between two lines and two arcs in the picture. The area for the split pixels needs to be recalculated at the same rate. So I need to sum the areas of pixels multiplied by their intensities, not just the area of the pixels in between. Thank you for your interest.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1318850/image.png)
1 个评论
回答(1 个)
Image Analyst
2023-3-7
I would get the list of (x,y) coordinates for each arc, then call poly2mask. Then call nnz or bwarea or regionprops or polyarea
7 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!