color balance (白平衡)

本文介绍了OpenCV3.0中xphoto模块的简单白平衡算法,该算法旨在使图像中最亮部分为白色,最暗部分为黑色。通过调整RGB通道的直方图,去除颜色偏移。此外,还探讨了Adobe Photoshop的"auto levels"命令使用的robust color balance技术,并提供了代码实现,指出原算法可能存在的问题及改进方案。
摘要由CSDN通过智能技术生成

opencv3.0 xphoto模块包含了简单白平衡算法。没有注明算法原理,出自哪篇论文,很不方便。搜索之后,发现一篇博客不错,介绍了该原理。同时实现了robust color balance。


白平衡的意思就是:是图片中最亮的部分为白色,最暗的部分为黑色。其余部分进行拉伸。博客效果如下:

原图:


robust color balance:




This is the color balancing technique used in Adobe Photoshop's "auto levels" command. The idea is that in a well balanced photo, the brightest color should be white and the darkest black. Thus, we can remove the color cast from an image by scaling the histograms of each of the R, G, and B channels so that they span the complete 0-255 scale. In contrast to the other color balancing algorithms, this method does not separate the estimation and adaptation steps.
In order to deal with outliers, Simplest Color Balance saturates a certain percentage of the image's bright pixels to white and dark pixels to black. The saturation level is an adjustable parameter that affects the quality of the output. Values around 0.01 are typical.


简单的说就是:在rgb三通道上分别统计每个像素值的出现次数。将1%的最大值和最小值设置为255和0。其余值映射到(0,255),这样使得每个值通道的值在rgb中分布较均匀。达到颜色平衡的结果。. 


opencv实现了简单白平衡。使用多层直方图,比单个直方图的优点,应该是速度更快。实际上并不一定要这么实现。且算法的实现应该有问题。以下是修改后代码,中文部

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值