颜色直方图归一化 [英] Color Histogram Normalization

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

问题描述

昨天我在这个问题上找到了这个问题:
直方图规范化

I asked this question yesterday on this thread found here: Histogram Normalization.

但是,我尝试使用链接中的一些想法对图像执行标准化,并得到以下结果。在这里,我将所有像素标准化为50%,黑白像素除外。
我使用的公式是:(像素 - 分钟)/(最大 - 分钟)* 127

However, I tried using some ideas i got in link to perform Normalization on a image and i got the following result. Here I normalize all the pixel to 50% except the black and white pixels. The formula i used is:(pixel - min) / (max - min) * 127

pixel = (float)src.at<uchar>(j,i);


if (pixel == 255)
{
    img.at<uchar>(j,i) = pixel;
}

if (pixel == 0)
{
    img.at<uchar>(j,i) = pixel;
}

/*if (min == 0 || max == 0 || (max - min == 0))
{
    img.at<uchar>(j,i) = pixel;
}
else
{*/
    normal__ = ((pixel - min)/(max - min)) * ( 127);
    img.at<uchar>(j,i) = normal__;
//}

}

结果:

RED PIXEL: MIN = 0 MAX = 253
GREEN PIXEL: MIN = 0 MAX = 254
BLUE PIXEL: MIN = 0 MAX = 255

标准化前的图像

Image before Normalization

使用上述公式进行标准化后:

After Normalization using above formula:

现在,我确认我的步骤是否正确是正确的。谢谢.. :)

Now, I am confirming if my steps are correct. Thank you..:)

推荐答案

因为陈述

  normal__ = ((pixel - min)/(max - min)) * ( 127);
   img.at<uchar>(j,i) = normal__;

不在if-else语句中,它们也适用于黑白像素。那没关系吗?

are not in an if-else statement, they get applied to the black and white pixels too. Is that fine?

这篇关于颜色直方图归一化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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