opencv 改变图像对比度

来源:互联网 发布:wow数据库7.0 编辑:程序博客网 时间:2024/05/01 07:28
static void on_Contrast(int, void*){    //创建窗口    namedWindow("【原始窗口】", 1);    for (int y = 0; y < g_srcImage.rows; y++)    {        for (int x = 0; x < g_srcImage.cols; x++)        {            for (int c = 0; c < 3; c++)            {                g_dstImage.at<Vec3b>(y, x)[c] = saturate_cast<uchar>((g_nContrastValue*0.01)*(g_srcImage.at<Vec3b>(y, x)[c]));            }        }    }    //显示图像    imshow("【原始窗口】", g_srcImage);    imshow("【效果窗口】", g_dstImage);}

原图像
原图像
效果图
效果图

0 0
原创粉丝点击