红眼算法 [英] Red eye reduction algorithm

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

问题描述

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

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.)

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

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