How to go about implementing a program 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.
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