saturate_cast<uchar>( (g_nContrastValue*0.01)*( g_srcImage.at<Vec3b>(y,x)[c] ) + g_nBrightValue );

来源:互联网 发布:亡者归来第三季 知乎 编辑:程序博客网 时间:2024/05/29 04:45

g_dstImage.at<Vec3b>(y,x)[c] = saturate_cast<uchar>( (g_nContrastValue*0.01)*( g_srcImage.at<Vec3b>(y,x)[c] ) + g_nBrightValue );

1、使用image.at<Vec3b>(y,x)[c]表示:y是像素所在的行,x是像素所在的列,c是B、G、R三分量。

2、使用saturate_cast<uchar>对结果进行转换,因为运算结果可能会超出像素的取值范围。

0 0
原创粉丝点击