# How to make color balance of photoshop using opencv

I want to make the same thing programmatically like Color balance in Photoshop , like in below image

if we have same bar positions in Photoshop then how we can make them in OpenCV , because the problem which I am not understanding is that we have the image with RGB format yes we can convert in other color format but how I can understand these values (do we need to subtract the Cyan values in OpenCV if Cyan Level is -20 in PS ? Or we need to Add ?) and did the same operation in OpenCV , For example if I need to change values in Cyan , Magenta and Blue Do I need to convert image first to add values in Cyan and magenta and then convert it back to BGR and then increase blue ? And is there any built in function in OpenCv for Shadows , MidTones and Highlight

I am trying something like this

Mat img = imread("E:\\raw_3.jpg");
vector<Mat> colors;
split(img,colors);
colors[0] += 69;
colors[1] += 40 ;
colors[2] -= 23 ;
merge(colors,img);
imshow("image" , img);
imwrite("E:\\color_balance.jpg",img);
waitKey();


for Cyan - red = -23 Magenta - Green = 40 Yellow - Blue = 69 But i am not getting the accurate result as it should be

• @Drazick No , not yet – ARG Mar 4 '15 at 0:06
• Hope so one day we solve it down – ARG Mar 4 '15 at 16:04