How can I find the sum of the area in a specified region in the image according to the pixel intensity value?

4 次查看(过去 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.
  1 个评论
DGM
DGM 2023-3-6
编辑:DGM 2023-3-6
You would need to create an accurately weighted antialiased mask. I don't know of any existing tools, and I have yet to finish the geometric masking tools for MIMT.
Steve describes a method in this series on creating accurate binarized masks. See also the prior posts on poly2mask() and this discussion.

请先登录,再进行评论。

回答(1 个)

Image Analyst
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 个评论
Selim ARAS
Selim ARAS 2023-3-12
I solved my problem myself and I will write how I solved it later. However, I will explain why I use it first after I publish my article. To solve this, you need an advanced knowledge of mathematics and geometry, you are right. It took quite a while to figure this out. I was also asking to gain this time. Thanks.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by