Estimating area percentage in a selection

Hi everyone,

A newbie here.

Any method (or plugin) to estimate the white (or black) area percentage in the selection rectangle as shown in the attached image? I mean (White Area / Area of rectangle selection) X 100%

I did find some technique online, but mostly applicable to the whole image instead of a selected area.

Any idea?
image findings

Use Analyze > Set Measurements… and activate the Area fraction option. This will allow you to measure Area % within your current selection (ROI) when using Analyze > Measure M.


From the user guide:

Area fraction For thresholded images is the percentage of pixels in the image or selection that have been highlighted in red using Image▷Adjust▷Threshold… T. For non-thresholded images is the percentage of non-zero pixels. Uses the heading %Area.

1 Like

I tried your suggestion, but I still can’t get the result.
Correct me if I’m wrong, but the values generated refer to the rectangle selection instead of the proportions of white/black color inside the rectangle selection.

Anyway, attached is the raw image I’m working on:

The idea is exactly what @imagejan mentioned. Area fraction is the way to go for you and it returns the area fraction within the rectangle selection, but you’re image isn’t binary. You have to define what the ‘foreground’ and ‘background’ is using thresholding.
Similar concept as first example here: https://imagej.nih.gov/ij/docs/pdfs/examples.pdf

As you’re interested in the white area

  • Go to Adjust-> Threshold (Untick Dark Background)
  • Close the window
  • Process->Binary->Make Binary
  • Analyse->Set Measurements-> Only tick Area fraction
  • Analyse->Measure
    This gives you area fraction of the white colour (or whatever you define is the foreground) in the rectangular box you’ve drawn.

Normally, the background is black and foreground is white; so you would leave the Dark Background box checked. In you’re image, if you do that, the dark bits are considered foreground and white as background, so you’re binary image will be inverted… Try it and you’ll see the difference. This will give you the % area of the black in the box you draw.

1 Like

Thanks for the reply.
Yeah I finally get it. Thanks again @imagejan und @pr4deepr.
I missed this step Analyse -> Set Measurements -> Only tick Area fraction

Since this image is binary white-black in color, so not that much of a problem may occur.
But what if multiple colors involved in the image, should the step to do area estimation be the same
as suggested above? I mean the Process -> Binary -> Make Binary is still needed?

1 Like

If its colour, then you can either convert it to 16 bit grayscale and perform thresholding, OR maybe use colour threshold.

2 Likes

5 posts were split to a new topic: Color Threshold RGB - missing % area measurement