有没有一种更快的方法来在OpenCV中应用亮度? [英] Is there a quicker way to apply brightness in OpenCV?
本文介绍了有没有一种更快的方法来在OpenCV中应用亮度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我有以下代码将像素的亮度更改为20.
In my application I have the following code which changes the brightness of a pixel by 20.
for( int y = 0; y < src.rows; y++ )
{
for( int x = 0; x < src.cols; x++ )
{
for( int c = 0; c < 3; c++ )
{
src.at<cv::Vec3b>(y,x)[c] = cv::saturate_cast<uchar>( ( src.at<cv::Vec3b>(y,x)[c] ) + 20 );
}
}
}
有没有更有效的方法来应用这种效果?
Is there a more efficient way of applying this effect?
推荐答案
我不明白为什么您不能/不简单使用:
I do not understand why you cannot/do not simply use:
src = src + cv::Scalar(20,20,20);
这会做吗?
这篇关于有没有一种更快的方法来在OpenCV中应用亮度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文