Filter löschen
Filter löschen

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

7 Ansichten (letzte 30 Tage)
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 Kommentar
DGM am 6 Mär. 2023
Bearbeitet: DGM am 6 Mär. 2023
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 7 Mär. 2023
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 Kommentare
Selim ARAS
Selim ARAS am 12 Mär. 2023
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.
DGM am 13 Mär. 2023
Yeah, those headaches are kind of why I still haven't added it to MIMT yet :)

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by