白平衡算法 [英] White balance algorithm

查看:526
本文介绍了白平衡算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一些图像处理,我需要一个自动白平衡算法,这不是过于密集的CPU计算时间方面。任何建议?

I'm doing some image processing and I need an automatic white balancing algorithm that's not too intensive in terms of CPU computation time. Any recommendations?

编辑:如果它是有关提高效率,我会用彩色图像实现它在Java中的整数数组

and if it's relevant to efficiency, I'll be implementing it in Java with color images as an array of integers.

推荐答案

一个相对简单的算法就是在屏幕上平均最亮和最暗像素的色调(在HSV或HSL)。在紧要关头,走,只有最亮的像素。如果亮和最暗的色调差异太大,去与亮像素。如果是暗黑色的附近去与亮像素。

A relatively simple algorithm is to average the hues (in HSV or HSL) of the brightest and darkest pixels on the screen. In a pinch, go with the brightest pixel only. If the hues between brightest and darkest are too different, go with the bright pixel. If the dark is near black go with the bright pixel.

为什么连看暗像素?有时暗不近黑色,并在环境光或雾霾或暗示。

Why even look at the dark pixel? Sometimes the dark is not near black, and hints at the ambient light or fog or haze.

这将是有意义的你,如果你是一个沉重的Photoshop用户。在相片亮点无关(或弱相关的)的对象的基本颜色。他们的偏色光你最好的重新presentation,除非图像是如此过度曝光,一切都已经不堪重负的CCD。

This will make sense to you if you're a heavy Photoshop user. Highlights in a photo are unrelated (or weakly related) to the underlying color of the object. They are your best representation of the color cast of the light, unless the image is so overexposed that everything has overwhelmed the CCDs.

然后调整所有像素的色调。

Then adjust the hues of all pixels.

您需要快速RGB到HSV和HSV到RGB功能。 (不过也许你可以在RGB工作的像素校正用LUT或线性插值。)

You'll need fast RGB to HSV and HSV to RGB functions. (But maybe you can work in RGB for the pixel corrections with a LUT or linear interpolation.)

您不想去的平均像素颜色或最流行的颜色。这样疯狂的谎言。

You don't want to go by average pixel color or most popular color. That way lies madness.

要快速找到最亮的颜色(和最暗的),你可以在RGB的工作,但你应该有乘数为绿色,红色和蓝色。在一个RGB显示器,255绿色亮超过255个红色比255的蓝色亮。我曾经有过很好的乘数在我的头上,但很可惜,他们已经逃离了我的记忆。你或许可以谷歌他们。

To quickly find the brightest color (and the darkest one), you can work in RGB, but you should have multipliers for green, red, and blue. On an RGB monitor, 255 green is brighter than 255 red which is brighter than 255 blue. I used to have good multipliers in my head, but alas, they have fled my memory. You can probably google for them.

这将在其中有没有什么亮点的图像失败。哑光手绘墙,例如。但我不知道你可以做些什么。

This will fail in an image which has no highlights. A matte painted wall, for example. But I don't know what you can do about that.


有许多改进,使这个简单的算法。你可以从每个细胞等平均多明亮像素,网格中的图像,并抓住亮区和暗像素实现算法后,您会发现一些明显的调整。

There are many improvements to make to this simple algorithm. You can average multiple bright pixels, grid the image and grab bright and dark pixels from each cell, etc. You'll find some obvious tweaks after implementing the algorithm.

这篇关于白平衡算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆