Home » Php » c# – Extract chromaticness/relative chroma from HSV

c# – Extract chromaticness/relative chroma from HSV

Posted by: admin July 12, 2020 Leave a comment

Questions:

I am trying to figure out how to get chromaticness out of HSV (alternative RGB). Problem is; I barely know what chromaticness is. According to the small information available on the net it is usually refered to “relative chroma” which is a combination of hue and saturation.

From http://www.huevaluechroma.com/012.php:

Another term for the concept of chroma relative to an assumed maximum
is chromaticness from the Swedish NCS system

I do have a the RGB which I have converted to HSV in PHP. I hope there is anyone out there who can provide their expertise in this question because there seems to be very limited information documented. I need it to validate NCS-codes.

Chromaticness calculation this far:

   //$hsv is array(h, s, v), maximum considered to be 10000        
   $chroma = $hsv[1] * $hsv[2];
   $chromaticness = $chroma / 10000;

For instance, the color S 2065-B (#0073B0) gives me chromaticness 69% using the calculation above when it should be 65%. Also, the color S 0580-Y (#FECB00) gives me 99% when it should be 80%?

The HSV in these examples I am getting are:

#0073B0 { ‘H’ => 200.79545454545, ‘S’ => 100, ‘V’ => 69.019607843137 }

#FECB00 { ‘H’ => 47.952755905512, ‘S’ => 100, ‘V’ => 99.607843137255 }

This solution is welcome in any programming language, however I am coding in PHP so it will probably be converted to that.

How to&Answers:

Chroma is the third attribute of the Munsell system beyond colour-hue and lightness/brightness.

Chroma in general defines colorfulness of the hue in question:
i.e. the attribute of color that indicates the degree of departure of the color from the gray of the same lightness. From here Color Space and Its Divisions by Rolf G. Kuehni (amply available at google books)

Chroma and saturation are identical for two colors having the same hue and lightness. Saturation remains constant regardless of brightness or lightness. Chroma, on the other hand, increases as lightness increases.

The coded formulas for Chroma are given here

Until you consider color-gamuts Chroma remains an open-ended quantity – ranging as it does from 0 to infinity.

NCS chromaticness is Chroma specified as a percentage – where 100% corresponds to some finite upper limit, see ISSN-03912051. You will need to chose that finite value to get a good working dynamic range in your computational system.

Trust that helps.

Answer:

I think the issue you are having is related to the fact that the four basis colors in the NCS system do not all have 100% values in the HSV system.

For example, a fully saturated and fully bright orange in the NCS system would be half way on the HSV arc between between NCS yellow and NCS red. NCS yellow has an HSV Value of 100%, but NCS red has an HSV Value of only 77%, so this orange would have a Value of about 88.5%. Nonetheless, the NCS chromaticity would still be 100%, even though your calculation from HSV would give it a chromaticity of 88.5%. (There’s also the issue that NCS red is only 99% saturated in the HSV system, but I’m ignoring that.)

The HSV values for the NCS basis colors are as follows:

white 100%
black 0%
green 63%
red 77%
yellow 100%
blue 74%

source: https://en.wikipedia.org/wiki/Natural_Color_System

I think what you need to do is, after you’ve calculated the NCS GY/GB/RY/RB “hue”, calculate the maximal HSV Value for that NCS hue based on proration from the two relevant NCS basis colors, then calculate the NCS chromaticity as a fraction of that maximal HSV Value (i.e., divide by that maximal Value, if we’re dealing with numbers between 0 and 1). Thus, we would give a saturated Y50R orange with an HSV Value of 22.125% a chromaticity of 25%, since 22.125% is 25% of the maximal value of 88.5% for Y50R orange.

Note that this means you will have to deal with RGB/HSV colors that fall above the maximal Values for NCS colors. In those cases I’d probably just scale the HSV Value back to the maximum for NCS colors with the same hue.