# How Could One Imitate Photoshop's Vibrance Filter with OpenCV?

Can somebody please explain how Photoshop vibrance function can use in opencv c++ ? so that I may reproduce the same effects in my application. Here is the vibrance documentation

The Vibrance in Photoshop is a mask guided saturation.
What does it mean?
It means we add saturation only to pixels marked by the mask while leaving others untouched.
The mask evaluates the original level of the saturation of each pixel.
If the pixel is highly saturated, then when Vibrance is applied this pixel will be excluded.
Namely vibrance works only on less saturated pixels.

How could we create such a mask?
We transform each pixel from RGB Color Space to HSL (Hue, Saturation, Lightness) Color Space.
Then we take only the Saturation values for all pixels and normalize into the [0, 1] range where 0 is not saturated pixel and 1 is fully saturated pixel.

Then we add saturation only to pixels with low value of saturation.

I'm not an expert on OpenCV, but the above should be pretty easy to integrate in OpenCV (Given it has RGB to HSL Conversion, You can use HSV or HLS)