void BrightnessEnhance(Mat &src, Mat &dst,int nBrightValue = 50)
{
nBrightValue +=50;
if (nBrightValue<50)
{
nBrightValue = 50;
}
if (nBrightValue>150)
{
nBrightValue = 150;
}
//三个for循环,执行运算 g_dstImage(i,j) =a*g_srcImage(i,j) + b
for(int y = 0; y < src.rows; y++ )
{
for(int x = 0; x < src.cols; x++ )
{
for(int c = 0; c < 3; c++ )
{
dst.at<Vec3b>(y,x)[c]= saturate_cast<uchar>( (nBrightValue*0.01)*(src.at<Vec3b>(y,x)[c] ));
}
}
}
}
图像亮度增强
最新推荐文章于 2024-08-13 08:23:27 发布