简体   繁体   English

在OpenCV中使2个RGB图像之间的颜色一致

[英]Conform colors between 2 RGB images in OpenCV

i've two RGB images of the same subject with different color values...my goal is to conform colors and merge images. 我有相同主题的两个RGB图像,具有不同的颜色值...我的目标是使颜色一致并合并图像。 i've tried by converting RGB->HSV space and equalizing v channel, but the result is unsatisfactory. 我已经尝试过通过转换RGB-> HSV空间并均衡v通道,但是结果并不令人满意。 Some solutions? 一些解决方案?

Thanks a lot. 非常感谢。

您可以将图像都转换为黑白图像,然后将彩色像素值缩放到特定范围,然后开始进行比较。

Calculate the histograms of both images. 计算两个图像的直方图。 They should be the same, but they probably aren't (given the question). 它们应该是相同的,但是(考虑到问题)它们可能不是。

To take a simple example, in one picture 50% of the blue values might be below 110, while in the other 50% are below 130. You then will want to convert 110 to 120 in the first image, and 130 to 120 in the second. 举一个简单的例子,在一张图片中,蓝色值的50%可能低于110,而在另一张图片中,50%的蓝色值低于130。然后,您将希望在第一张图像中将110转换为120,在蓝色图像中将130转换为120。第二。

You'd want to do the same for 25% and 75%; 您可能希望为25%和75%做同样的事情; depending on the actual differences you might want to partition the histograms in even smaller parts. 根据实际差异,您可能希望将直方图划分为更小的部分。

Remember to do this for all three histograms. 记住对所有三个直方图都这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM