//2013.9 eageldiao
#ifdef HISTOGRAM_RGB
unsigned int lut[];
unsigned intncount[]={},ncount1[]={},ncount2[]={};
int nTemp;
//b
for(y=;yheight;y++)
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
ncount[srcrow[*x]]++; //统计灰度级数量
}
}
for (int i=;i<;i++)
{
nTemp=;
for (int j=;j<=i;j++)
{
nTemp+=ncount[j];
}
lut[i]=nTemp*/src->width/src->height;//确定变换函数
}
for(y=;yheight;y++) //均衡化
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
srcrow[*x]=lut[srcrow[*x]];
}
}
//g
for(y=;yheight;y++) //统计灰度级 数量
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
ncount1[srcrow[*x+]]++;
}
} for (int i=;i<;i++)
{
nTemp=;
for (int j=;j<=i;j++)
{
nTemp+=ncount1[j];
}
lut[i]=nTemp*/src->width/src->height; //确定变换函数
} for(y=;yheight;y++) //均衡化
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
srcrow[*x+]=lut[srcrow[*x+]];
}
} //r
for(y=;yheight;y++) //统计灰度级 数量
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
ncount2[srcrow[*x+]]++;
}
}
for (int i=;i<;i++)
{
nTemp=;
for (int j=;j<=i;j++)
{
nTemp+=ncount2[j];
}
lut[i]=nTemp*/src->width/src->height;//确定变换函数
}
for(y=;yheight;y++) //均衡化
{
unsigned char *srcrow= (unsignedchar*)(src->imageData+y*src->widthStep);
for (x=;xwidth;x++)
{
srcrow[*x+]=lut[srcrow[*x+]];
}
}
#endif

[code]彩色图像直方图均衡化 histogram_rgb的更多相关文章

  1. 彩色图像的直方图均衡化matlab代码

    彩色图像的直方图均衡化 - YangYudong2014的专栏 - CSDN博客 http://blog.csdn.net/yangyudong2014/article/details/4051503 ...

  2. 数学之路-python计算实战(14)-机器视觉-图像增强(直方图均衡化)

    我们来看一个灰度图像,让表示灰度出现的次数,这样图像中灰度为 的像素的出现概率是  是图像中全部的灰度数, 是图像中全部的像素数,  实际上是图像的直方图,归一化到 . 把  作为相应于  的累计概率 ...

  3. 灰度图像--图像增强 直方图均衡化(Histogram equalization)

    灰度图像--图像增强 直方图均衡化(Histogram equalization) 转载请标明本文出处:http://blog.csdn.net/tonyshengtan,欢迎大家转载,发现博客被某些 ...

  4. OpenCV-跟我一起学数字图像处理之直方图均衡化

    从这篇博文开始,小生正式从一个毫不相干专业转投数字图像处理.废话不多说了,talk is cheap. show me the code. 直方图均衡化目的 由于一些图像灰度的分布过于集中,这样会导致 ...

  5. OpenCV图像增强算法实现(直方图均衡化、拉普拉斯、Log、Gamma)

    http://blog.csdn.net/dcrmg/article/details/53677739 1. 基于直方图均衡化的图像增强   直方图均衡化是通过调整图像的灰阶分布,使得在0~255灰阶 ...

  6. matlab 直方图均衡化(含rgb)

    步骤: 统计原图像素每个像素的个数 统计原图像<每个灰度级的像素的累积个数 家里灰度级得映射规则 将原图每个像素点的灰度映射到新图 代码: clear all I=imread('1.jpg') ...

  7. 对比度受限的自适应直方图均衡化(CLAHE)

    直方图均衡化(HE)是一种很常用的直方图类方法,基本思想是通过图像的灰度分布直方图确定一条映射曲线,用来对图像进行灰度变换,以达到提高图像 对比度的目的.该映射曲线其实就是图像的累计分布直方图(CDF ...

  8. OpenCV计算机视觉学习(9)——图像直方图 & 直方图均衡化

    如果需要处理的原图及代码,请移步小编的GitHub地址 传送门:请点击我 如果点击有误:https://github.com/LeBron-Jian/ComputerVisionPractice 1, ...

  9. 图解直方图均衡化及其Python实现

    在理解直方图均衡化的过程中,参考了一些书籍和博客,让人困惑的是,笔者对于直方图的理解还是停留在表面,并没有深入理解其内涵.因此,本文拟结合图片对直方图的概念进行阐述,并给出其Python实现,最后对她 ...

随机推荐

  1. System.Convert.cs

    ylbtech-System.Convert.cs 1. 程序集 mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c56 ...

  2. iOS开发系列-网络状态监控

    概述 在网络应用中,需要对用户设别的网络状态进行实时监控,可以让用户了解自己的网络状态出现网络问题提示用户. 一般在网络状态不好的场景下需要做一些处理比如: WIFT/3G/4G网络:自动下载高清图. ...

  3. Error:(27, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2约束布局constraint-layout导入失败的解决方案

    运行demo提示错误: Error:(27, 13) Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2 ...

  4. differential related impedance and termination

    Impedance (1) Z0 Z0 is the impedance of one T-line while other lines are held at 0. Single end. (2) ...

  5. 廖雪峰Java11多线程编程-3高级concurrent包-4Concurrent集合

    Concurrent 用ReentrantLock+Condition实现Blocking Queue. Blocking Queue:当一个线程调用getTask()时,该方法内部可能让给线程进入等 ...

  6. 0819NOIP模拟测试赛后总结

    这次挂得很悲伤. T1.T3我都想到正解了…… 结果T1少看了个条件:20%保证ai互不相等.以为100%…… 然后挂到了20分,赛后加了个set不到1分钟就A掉了.. T2把分骗满跑路. T3sb线 ...

  7. natapp出现Invalid Host header

    前端是vue 3.x 项目,需要更改vue的配置文件 vue.config.js,在module.exports中添加devServer:{disableHostCheck:true}

  8. 博弈论 | 暑期集训Day2学习总结

    今天的知识点为博弈论. 相比于昨天完全陌生难懂的概念,今天接触到的东西应该算是非常容易理解了,一下子又对ACM的学习重拾信心.毕竟game作为主题也吸引眼球,每种博弈背景下引入的游戏介绍也十分有趣.主 ...

  9. django中的request对象

    Request 我们知道当URLconf文件匹配到用户输入的路径后,会调用对应的view函数,并将  HttpRequest对象  作为第一个参数传入该函数. 我们来看一看这个HttpRequest对 ...

  10. Struts2入门问题

    一 使用Struts 2 开发程序的基本步骤 加载Struts2 类库 配置web.xml文件 开发视图层页面 开发控制层Action 配置struts.xml文件 部署.运行项目 第一步先导架包:在 ...