尝试使用opencv做photoshop的颜色平衡 [英] Trying to make color balance of photoshop using opencv
问题描述
我想在 Photoshop
中像颜色平衡
>
>
如果我们在Photoshop中有相同的位置,那么我们如何在OpenCV中使用它们,因为我不能理解的问题是我们有 RGB
format是的,我们可以转换为其他颜色格式,但我怎么能理解这些值(我们需要减去OpenCV中的青色值,如果Cyan Level是-20在PS?或者我们需要添加?),并做同样的操作在OpenCV,
例如,如果我需要更改 Cyan
, Magenta
和 Blue
我需要先转换图片以添加青色和品红色的值,然后将其转换回 BGR
,然后增加 blue
?
在OpenCv中有对于阴影,中音和突出显示的任何内置函数
像这样
Mat img = imread(E:\\raw_3.jpg);
vector< Mat>颜色;
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();
青色 - 红色= -23洋红色 - 绿色= 40黄色 - 蓝色= 69但我不是得到准确的结果,因为它应该是
1,尝试 - 所有你需要做的是更改符号, !
2,了解其他颜色表示< a> - 你几乎不想在RGB中直接进行这种操作。
颜色非常复杂,开始的好地方是 color faq
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
1, Try it - all you have to do is change the sign, and recompile!
2, Learn about other color representations - you almost never want to do this sort of operation directly in RGB.
Color is surprisingly complex, a good place to start is the color faq
这篇关于尝试使用opencv做photoshop的颜色平衡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!