Calculating average color of pixels

PA
Posted By
Paul_Atkins
Sep 16, 2008
Views
488
Replies
6
Status
Closed
I need to analyze an image and read the value of each pixel, exclude the highest and lowest values (perhaps anything less than 10,10,10 and greater than 245,245,245) , then average the remaining. I may need to do this on each channel of RGB.

I can almost get a result blurring the sample and then using a large brush with the info tool, but is there any other method more direct and all inclusive?

Thank you,

Paul

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

GH
Gernot_Hoffmann
Sep 16, 2008
Paul,

like this (written after a short test):
Double click on Background Layer to make it editable.
Magic Wand, Tolerance 10 (of 255), Not Contiguous.
Eventually draw small white and a black rectangles.
Click on white pixels. Clear (Delete).
Click on black pixels. Clear (Delete).
Clear means transparent. These pixels don’t count.
Windows > Histogram.
Statistical values are indicated. You should read the
help text about Cache.
If necessary, the method how to exclude highest and
lowest values can be applied to channels.

Best regards –Gernot Hoffmann
P
PeterK.
Sep 17, 2008
You can use Filter-Blur-Average to get the colours blurred into a swatch representing the overall average colour, and can view the RGB value in the Info palette. Use Gernot’s method above to exclude the values you don’t want. Note that the Blur-Average filter was only introduced with Photoshop CS, so if you are using version 7 or earlier, you won’t have it.
PA
Paul_Atkins
Sep 18, 2008
I had considered the Blur Average filter, but I was concerned that it was doing precisely what it says it is doing.

Gernot, do you think I can write an action to lift out those thresholds? I am pretty savvy with actions, but not sure if I can make this one work.

Paul
GH
Gernot_Hoffmann
Sep 18, 2008
Paul,

sorry, I’m not familiar with actions.
Why should one use Blur Filter Average instead
of the calculations in Histogram ?

Best regards –Gernot Hoffmann
MR
Mark_Reynolds
Sep 21, 2008
Average calculates a mathematical average for each channel, and its exactly what you want: You can combine two threshold adjustments into a mask to wipe out the top and bottom 10 values creating your initial selection – then run the Average filter on the remaining pixels.

Its possible to do all of this with an action, and wipes out the need for any complex manual calculation, unless of course you WANT to make life difficult for yourself
PA
Paul_Atkins
Sep 22, 2008
Thank Gernot, I think I have worked out an action:
1-turn background into a layer
2-use colour range to select shadows and highlight
3-delete selected
4-read histogram average (not sure how to output this number though)

Thanks for your help guys,

Paul

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections