How to make color balance of photoshop using opencv
OpenCV don't have any apis to separate data into lowlight,midtones and highlights.But you can categorize pixels in image into shadows,mid-tones and highlights by setting some thresholds.As they depend on the luminance first convert your image into YUV. If its of 8 bit depth then the pixels with luminance less than 70 are lowlight, pixels ranging from 70 -180 are midtones and 180-255 are highlight. 

When cyan-red is -20,decreasing the red by -20 is just not enough. Because it will also affect the luminance of the image. So instead of decreasing red by 20 decrease it by 10 and increase green and blue by 5. Decreasing the red is same as increasing blue and green,while it also maintains the luminance. You can do the same for Magenta-Green and Yellow-Blue. Hope this helps you.