# How to Measure the Intensity / Saturation of a Color in an Image?

I have a task of developing an application to measure the intensity of a color in an image. I am researching about how to go about it.

Intensity refers to the purity of a hue. Intensity is also known as Chroma or Saturation. The highest intensity or purity of a hue is the hue as it appears in the spectrum or on the color wheel. Source

The image will be RGB but I can convert it HSV or any other color space.

I am not asking for code, but just high level steps on how to do it.

I am thinking of using OpenCV library for Java.

• Now why a downvote! An explanantion of a downvote is the only way to that leads to the correction of the mistake. Commented Nov 28, 2015 at 20:29

intensity is the amplitude of the RGB values in if transparency is 1, so you can get brightness by the sum of the rgb values, 1,1,1 is white. 0,0,0 is black. average the entire image and you have its intensity.

also it's the V value of HSV, so you can use rgb or hsv, map the average v per pixel and you have it's intensity also.

I think that blue and green and red appear to the eye to be the same brightness for the same digital level, but if the eye perceives the three with a small difference in intensity ina non linear way you can probably get some academic research and graph the psychointensity value of it depending on the color.

• Are you sure that intensity is the V channel in HSV? Commented Jun 29, 2016 at 7:57

You can find mapping from RGB space to HSV here: https://math.stackexchange.com/questions/556341/rgb-to-hsv-color-conversion-algorithm

For other spaces, you can refer to vision modelling textbooks, i.e: Digital video quality, Stefan Winkler

Perceived color hue and saturation is a different matter. You do not find that so easily as inspecting the components of HSV.

First there is the obvious (generally unobservable) factors of screen color transfer output and the context of the room you are in (lit lamps? mid day?).

Secondly, there is the context that you can observe, the context of the image. Low-level to mid-level vision mechanism may be emulated to try to estimate a perceptual hue. This can go all the way to high level too, as an example: the same pixel color red can be on a strawberry with specularities, as found in a murder scene..... spooky isnt it?!