红眼算法算法

由网友(€没那么多情绪)分享简介:我需要实现红眼减轻对我工作的应用程序。I need to implement red eye reduction for an application I am working on.谷歌搜索主要是提供链接到商业最终用户产品。Googling mostly provides links to commercial...

我需要实现红眼减轻对我工作的应用程序。

I need to implement red eye reduction for an application I am working on.

谷歌搜索主要是提供链接到商业最终用户产品。

Googling mostly provides links to commercial end-user products.

你知道一个好的红眼消除算法,它可以在GPL的应用程序中使用?

Do you know a good red eye reduction algorithm, which could be used in a GPL application?

推荐答案

我的方式迟到了这里,但对于未来的搜索我用下面的算法用于个人应用程序,我写的。

I'm way late to the party here, but for future searchers I've used the following algorithm for a personal app I wrote.

首先,该区域的减少是由用户选择,并传递到红眼还原方法作为中心点和半径。该方法遍历半径内的每个像素,并执行以下计算:

First of all, the region to reduce is selected by the user and passed to the red eye reducing method as a center Point and radius. The method loops through each pixel within the radius and does the following calculation:

//Value of red divided by average of blue and green:
Pixel pixel = image.getPixel(x,y);
float redIntensity = ((float)pixel.R / ((pixel.G + pixel.B) / 2));
if (redIntensity > 1.5f)  // 1.5 because it gives the best results
{
    // reduce red to the average of blue and green
    bm.SetPixel(i, j, Color.FromArgb((pixel.G + pixel.B) / 2, pixel.G, pixel.B));
}

我很喜欢这个结果,因为它们保持色彩强度,这意味着眼睛的光反射不会降低。 (这意味着眼睛保持他们的活着的样子。)

I really like the results of this because they keep the color intensity, which means the light reflection of the eye is not reduced. (This means eyes keep their "alive" look.)

阅读全文

相关推荐

最新文章