怎样调整图像的亮度、色度、饱和度和对比度?我要代码或者可用的DLL
来源:互联网 发布:js获取cookie 编辑:程序博客网 时间:2024/05/16 09:04
导读:
八月 23rd, 2007 by admin
谁有啊,因为我对vc不是很熟悉,所以自己不会做
网友回答:
发表者:sunrise
去intel的网站看看,上面有图像处理的库。
发表者:serenade
//调整图像的色度、亮度、饱和度
//作者:吴梦华 csdn上叫神曲
//wondertop@263.net
//2003-3-1
//用法:使用changehls函数,图像不能够带pitch。
//作用和photoshop的hue/saturation操作一致,取值范围也一样。
//要求图像为565
//目前为止只测试过改变色度,其它若有问题可以和我联系。
void changehls( word *pwimagebuf, int width, int height, int hue,
int lig, int sat )
{
float liglow=0;
float lighigh=1;
if( lig<0 )
lighigh = 1+lig/100.0f;
else if( lig>0 )
liglow = lig/100.0f;
float satlow=0;
float sathigh=1;
if( sat<0 )
sathigh = 1+sat/100.0f;
else if( sat>0 )
satlow = sat/100.0f;
int index=0;
float hls[3];
word color = 0xffff;
rgbtohls( hls, &color);
for( int row=0; row for( int col=0; col {
rgbtohls( hls, &pwimagebuf[index] );
// change hls
if( hls[0] != -1 )
{
hls[0] += hue;
hls[0] = (float)( (int)hls[0] % 360 );
if( hls[0]<0 ) hls[0]+=360;
if( hls[0]>360 ) hls[0]-=360;
hls[1] = (lighigh-liglow)*hls[1]+liglow;
hls[2] = (sathigh-satlow)*hls[2]+satlow;
}
else
hls[1] = (lighigh-liglow)*hls[1]+liglow;
pwimagebuf[index] = hlstorgb( hls );
index++;
}
}
void rgbtohls( float *phls, word *prgb )
{
float r,g,b;
r = ((*prgb)>>11)/31.0f;
g = (((*prgb)&0x7e0)>>5)/63.0f;
b = ((*prgb)&0x1f) / 31.0f;
// determine the lighteness.
float m1;
m1 = max( r,g );
m1 = max( m1, b );
float m2;
m2 = min( r,g );
m2 = min( m2, b );
float l = (m1+m2)/2;
// determine the sat
float s=0,h=0;
if( m1 == m2 )
{
s=0;
h=-1; // undefined.
}
else
{
if( l<= 0.5f )
s = (m1-m2)/(m1+m2);
else
s = (m1-m2)/(2-m1-m2);
//determine the hue
float cr = (m1-r)/(m1-m2);
float cg = (m1-g)/(m1-m2);
float cb = (m1-b)/(m1-m2);
if( r==m1) h = cb-cg;
if( g==m1) h = 2+cr-cb;
if( b==m1) h = 4+cg-cr;
h = 60*h;
if( h<0 ) h = h+360;
}
phls[0] = h;
phls[1] = l;
phls[2] = s;
}
word hlstorgb( float *phls )
{
float h = phls[0];
float l = phls[1];
float s = phls[2];
float r,g,b;
float m1,m2;
if( l<=0.5f )
m2 = l*(1+s);
else
m2= l+s-l*s;
m1 = 2*l-m2;
// check for zero saturation
if( s== 0 )
{
if( h==-1 )
r = g = b = l;
else
outputdebugstring( "error in hlstorgb. incorrect hls input./n" );
}
else
{
// determine the rgb
r = subhlstorgb( (int)h+120,m1,m2 );
g = subhlstorgb( (int)h,m1,m2 );
b = subhlstorgb( (int)h-120,m1,m2 );
}
int r=(int)(r*255);
int g=(int)(g*255);
int b=(int)(b*255);
return (r>>3<<11)|(g>>2<<5)|(b>>3);
}
float subhlstorgb( int h, float m1, float m2 )
{
h = h%360;
if( h<0 ) h+= 360;
if( h>360 ) h-=360;
if( h<60 ) return m1+(m2-m1)*h/60;
else if( h<180 ) return m2;
else if( h<240 ) return m1+(m2-m1)*(240-h)/60;
else if( h<=360 ) return m1;
return 0.0f;
}
发表者:jiangyunfeng
推荐:
向世明的《数字图象处理》,很不错哦!
发表者:robothn
去找cximage 的源码看吧
http://www.codeproject.com/bitmap/cximage.asp?target=cximage
发表者:kodo
http://asp.6to23.com/iseesoft/now.htm
到isee网站上面去看看
应该可以找得到的
发表者:bruce5260
思路你可以参考digital image processing.大概要用到直方图均衡,在那本书的前几章里头.
发表者:happyandy
去钩钩了!
本文转自
http://www.poptool.net/software/p139/A13917065.shtml
八月 23rd, 2007 by admin
谁有啊,因为我对vc不是很熟悉,所以自己不会做
网友回答:
发表者:sunrise
去intel的网站看看,上面有图像处理的库。
发表者:serenade
//调整图像的色度、亮度、饱和度
//作者:吴梦华 csdn上叫神曲
//wondertop@263.net
//2003-3-1
//用法:使用changehls函数,图像不能够带pitch。
//作用和photoshop的hue/saturation操作一致,取值范围也一样。
//要求图像为565
//目前为止只测试过改变色度,其它若有问题可以和我联系。
void changehls( word *pwimagebuf, int width, int height, int hue,
int lig, int sat )
{
float liglow=0;
float lighigh=1;
if( lig<0 )
lighigh = 1+lig/100.0f;
else if( lig>0 )
liglow = lig/100.0f;
float satlow=0;
float sathigh=1;
if( sat<0 )
sathigh = 1+sat/100.0f;
else if( sat>0 )
satlow = sat/100.0f;
int index=0;
float hls[3];
word color = 0xffff;
rgbtohls( hls, &color);
for( int row=0; row
rgbtohls( hls, &pwimagebuf[index] );
// change hls
if( hls[0] != -1 )
{
hls[0] += hue;
hls[0] = (float)( (int)hls[0] % 360 );
if( hls[0]<0 ) hls[0]+=360;
if( hls[0]>360 ) hls[0]-=360;
hls[1] = (lighigh-liglow)*hls[1]+liglow;
hls[2] = (sathigh-satlow)*hls[2]+satlow;
}
else
hls[1] = (lighigh-liglow)*hls[1]+liglow;
pwimagebuf[index] = hlstorgb( hls );
index++;
}
}
void rgbtohls( float *phls, word *prgb )
{
float r,g,b;
r = ((*prgb)>>11)/31.0f;
g = (((*prgb)&0x7e0)>>5)/63.0f;
b = ((*prgb)&0x1f) / 31.0f;
// determine the lighteness.
float m1;
m1 = max( r,g );
m1 = max( m1, b );
float m2;
m2 = min( r,g );
m2 = min( m2, b );
float l = (m1+m2)/2;
// determine the sat
float s=0,h=0;
if( m1 == m2 )
{
s=0;
h=-1; // undefined.
}
else
{
if( l<= 0.5f )
s = (m1-m2)/(m1+m2);
else
s = (m1-m2)/(2-m1-m2);
//determine the hue
float cr = (m1-r)/(m1-m2);
float cg = (m1-g)/(m1-m2);
float cb = (m1-b)/(m1-m2);
if( r==m1) h = cb-cg;
if( g==m1) h = 2+cr-cb;
if( b==m1) h = 4+cg-cr;
h = 60*h;
if( h<0 ) h = h+360;
}
phls[0] = h;
phls[1] = l;
phls[2] = s;
}
word hlstorgb( float *phls )
{
float h = phls[0];
float l = phls[1];
float s = phls[2];
float r,g,b;
float m1,m2;
if( l<=0.5f )
m2 = l*(1+s);
else
m2= l+s-l*s;
m1 = 2*l-m2;
// check for zero saturation
if( s== 0 )
{
if( h==-1 )
r = g = b = l;
else
outputdebugstring( "error in hlstorgb. incorrect hls input./n" );
}
else
{
// determine the rgb
r = subhlstorgb( (int)h+120,m1,m2 );
g = subhlstorgb( (int)h,m1,m2 );
b = subhlstorgb( (int)h-120,m1,m2 );
}
int r=(int)(r*255);
int g=(int)(g*255);
int b=(int)(b*255);
return (r>>3<<11)|(g>>2<<5)|(b>>3);
}
float subhlstorgb( int h, float m1, float m2 )
{
h = h%360;
if( h<0 ) h+= 360;
if( h>360 ) h-=360;
if( h<60 ) return m1+(m2-m1)*h/60;
else if( h<180 ) return m2;
else if( h<240 ) return m1+(m2-m1)*(240-h)/60;
else if( h<=360 ) return m1;
return 0.0f;
}
发表者:jiangyunfeng
推荐:
向世明的《数字图象处理》,很不错哦!
发表者:robothn
去找cximage 的源码看吧
http://www.codeproject.com/bitmap/cximage.asp?target=cximage
发表者:kodo
http://asp.6to23.com/iseesoft/now.htm
到isee网站上面去看看
应该可以找得到的
发表者:bruce5260
思路你可以参考digital image processing.大概要用到直方图均衡,在那本书的前几章里头.
发表者:happyandy
去钩钩了!
本文转自
http://www.poptool.net/software/p139/A13917065.shtml
- 怎样调整图像的亮度、色度、饱和度和对比度?我要代码或者可用的DLL
- PPStream调整亮度,色度,饱和度,对比度
- opengl 图像对比度、亮度、饱和度调节的glsl代码
- Android改变图像的饱和度、亮度和对比度
- Android改变图像的饱和度、亮度和对比度
- Opencv图像对比度和亮度的调整
- 图像亮度/对比度的调整
- as3.0 用代码设置“调整颜色”滤镜--------即:亮度、对比度、饱和度、色相的调整
- as3.0 用代码设置“调整颜色”滤镜--------即:亮度、对比度、饱和度、色相的调整
- 调整图片的饱和度,对比度,色彩,亮度,旋转图片
- videobalance 调整一个视频流的亮度、对比度、饱和度。
- 【Unity Shader入门练习】调整屏幕的亮度、饱和度和对比度
- Opencv图像对比度和亮度的调整-滚动条
- 基于OpenCV调整图像的对比度和亮度
- 怎样提取图像像素的灰度值,色度值和饱和度值等?
- 更改显示图片的色度亮度对比度和透明度
- 【学习OpenCV】图像的亮度/对比度调整
- OpenCV-调整图像的对比度、亮度
- 行转列,列分行,行合并列
- WAVE文件格式剖析
- 图形学-对比度变换-直方图均衡化-程序开发-3P代码网
- 图形学-降噪技术-2维中值滤波
- 在伦敦找方向(工作体会)
- 怎样调整图像的亮度、色度、饱和度和对比度?我要代码或者可用的DLL
- CSDN博客周刊·2008年第3期
- asp.net 参数format格式详细用法
- 搞懂java中的synchronized关键字
- Struts 2.0的Action讲解
- WOOA,寒假太无聊搜到这来了
- learning english
- 关于 Berkeley DB 的WIKI
- Improve performace: check your loops