What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How does photoshop measure area and count pixels?


Messages
19
Likes
0
The area of a circle that is 100 W X 100 H should be 7853.98 (Pix50x50). However, when I record measurements for this circle, the area displayed in my measurement log gives me 5720. My measurement scale is set to 1 pixel = 1 pixel.

Furthermore, in my histogram I get "Pixels: 5640."

What is the difference between what is shown in the histogram for Pixels and what is shown in the measurement log under "Area"?
 
Photoshop isn't very accurate on Windows based machines anyway, but I've tried it here and don't see the results you are getting....in fact for Photoshop its pretty close...

area_measurement_MT_01.png

How are you obtaining your results?

Regards.
MrToM.
 
That's odd, I just realized that the numbers that appear, indicating Height and Width next to the mouse while I was drawing a circle, were different from the values given for Height and Width in my measurement log.

When the numbers next to my mouse showed H:100 and W:100, the measurement log showed H and W to be 86.

When the numbers next to my mouse showed H:112 and W:112, the measurement log showed H and W to be 100. Still, this gave me an area of 7772, which is quite a big difference from the more accurate 7860.

Any idea about why it is behaving this way?

I am running on WIndows
 
Not yet...

Give me a run down of your workflow and I'll try and replicate it.
As you can see from my image the results I get are pretty close so it must be either your workflow or some setting somewhere...although I cant think what at the moment.

Regards.
MrToM.
 
If I use my Ellipse Tool, the numbers next to the mouse are consistent with the same measurement as those entered in the Tool Options bar. 7860

If I use the Elliptical Marquis Tool, the numbers next to the mouse are not consistent with the same measurement as those entered in the Tool Options bar. 7697

So...............use the Ellipse Tool for accuracy.
 
Here's a quick summary of the results presented thusfar in this thread, as well as some mathematically accurate computed areas:

Summary_of_results-Excel_screen_grab.jpg

Other than the two very odd initial entries from the OP, all the other area estimates have been clustered within 1 or 2% of the true, mathematically computed value. Given that PS is a pixel based program and hence, it can only do placements and measurements accurate to the number of pixels (eg, 1 pixel out of 100 in diameter = 1%), and the fractional error in the area becomes twice the fractional error in the diameter (because it is squared), all in all, I think PS is doing a very reasonable job. If the OP needs more accuracy and wants to stick with this method, then the only way to get more accurate numbers is to let the features of interest be larger than 100 pixels.

Personally, remembering previous threads about this problem, I strongly suspect that vastly larger errors will be introduced by shadowing and incorrect inclusion / exclusion in the selection of the features of interest, not limitations of the integer math involved.

Tom M
 
Last edited:
To clarify, I am using the elliptical marquee tool. I need to select a circular region of interest, not actually draw a circle.

When I use the ellipse tool, the numbers next to the mouse are consistent with the measurements shown for W and H in the tool options bar, which are 100 and 100. I don't see anything indicating an area measurement in the tool options bar.

Then when I draw a 100x100 circle with the elliptical marquee tool, it is much smaller than the 100x100 circle drawn with the ellipse tool.

ellipses and marquee tool 2.jpg

FURTHERMORE, while I am holding down shift and drawing the circle with the elliptical marquee tool, the circle IS the same size as the 100x100 circle drawn with the ellipse tool. THEN, when I release my hold on the left mouse click after dragging, the circle shrinks!

ellipses and marquee tool.jpg


Here is a rundown of my workflow:

1) I open a new, blank document set to the default Photoshop size
2) Draw a 100x100 circle with the elliptical marquee tool while holding down the shift key
3) Hit "Record Measurements" in the Measurement Log.

The Area given in the Measurement Log reads 5720, and the histogram reads "Pixels: 5640".

This happens on both a brand new blank documents, as well as in the .jpgs I am working on.

Set Measurement Scale is set to Default. When I change it to custom and set it to 1 pixel = 1 pixel, I get the same results.

I am in RGB Color mode, 8 Bits/Channel

Any idea where my strange results are coming from?

Thanks for your help guys!
 
...with feathering shouldn't the pixel count be larger than with no feathering?...
No...the feathering is from the outer edge inward, not from the outer edge outward.

For some reason Adobe have decided that any pixel with a transparency of 50% or less will not be 'shown' by the marching ants.....BUT those pixels are still part of the active marquee.

Its for this reason your marquee 'appears' smaller with the feathered edge....even though its physically the right size.

I can only guess that in this instance, when using the measure tools, that those pixels are NOT included.

Typical Adobe I'm afraid.....no consistency.

Regards.
MrToM
 
Last edited:
The question remains: What is the histogram measuring when it gives me "Pixels: 103471" in this picture, yet the measurement log gives the correct area of 6621510 for the elliptical marquee selection.

I've completely reset Photoshop to default settings/preferences

My goal is to calculate the percent of green pixels within the selected area. I've been using the number which I've highlighted for you in the attached image below as the divisor. Then after selecting the color range within the selected area, I use the new number in the histogram next to "Pixels:" as the dividend. So in the examples shown the pictures, I would do 1247/103471 = 0.012051. Should that result be correct? It seems I should be dividing into the Area, not whatever number the histogram is giving me.

Why would the histogram show the correct area for a 100x100 circle, but not for a larger selection?

It looks like the histogram stops showing the correct area once you start drawing circles that are larger than a certain size. The histogram showed the correct area for a 600x600 circle, butnot for a 700x700 circle.

histogram and area.jpg

histogram and area2.jpg
 
The answer remains: PS is not very accurate on Windows machines.

I've tried circles of 600px and 700px and see very little difference in the pixel count between the Histogram and the Measurement log, granted they are not identical but certainly close.

You're not looking at the cached histogram are you?
You are refreshing it each time you get the warning triangle telling you its a cached version....right?

Regards.
MrToM.

EDIT:
Looking at your images again it appears you are not.
 
Last edited:
Wow, so this definitely means that my results are going to be way off on the thousands of images I have already analyzed. I was definitely using the cached histogram results. I compared results to using the uncached histogram, and there are significant differences.
 
Turning Anti aliasing off didn't give me an accurate area measurement in the histogram. Only refreshing the histogram did.

I read in another forum that they a cached version of the image is used so as to generate the histogram (and other operations) faster. It would take longer to provide results based on the actual image. So my pixel count in the histogram was a consistent 1.5% of the number of actual pixels. It also has something to do with the level of zoom.
 
So how can I get Photoshop to only display information from the first cache level? The cache levels in my performance preferences is set to 1, yet the histogram is still giving me values from different cache levels.
 

Back
Top