码迷,mamicode.com
首页 > 其他好文 > 详细

一种计算图像曝光度(Exposure)的方法

时间:2015-05-10 12:57:06      阅读:587      评论:0      收藏:0      [点我收藏+]

标签:

       前几天在做图像曝光度(Exposure)这个小功能时,找了半天资料都没找到,后来在stackoverflow上翻到了计算方法,方法很简单,实际测试时,发现和photoshop效果还挺接近的。下面是基于opencv的相关代码示例,strength范围可以设置为-2.0到2.0:

// strength范围[-2.0, 2.0] 
int row = inputImg.rows;
int step = inputImg.step;
uchar* pInputImg = inputImg.data;
uchar* pOutputImg = outputImg.data;
for (int i = 0; i < row * step; i++)
{
	pOutputImg[i] = (uchar)min_uchar(255, max_uchar(0, pInputImg[i] * pow(2, strength)));
}
下面是效果图,左侧为原图,中间为photoshop调节曝光度结果图,右图为上述计算方法结果图:
  技术分享





一种计算图像曝光度(Exposure)的方法

标签:

原文地址:http://blog.csdn.net/grafx/article/details/45619731

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!