qt c++中取图像每个像素点的rgb的数值的方法
for(int i=0;i<curFrame.cols/5;i++)
{
for(int k=0;k<curFrame.cols/5;k++)
{
int temp_x=(int)(5*i+5);
int temp_y=(int)(5*k+5);
Scalar temp_color = curFrame.at<Vec3b>(temp_x, temp_y);
double blue=temp_color.val[0];
double green=temp_color.val[1];
double red=temp_color.val[2];
redsum+=red;
bluesum+=blue;
greensum+=green;
totalsum++;
}
}
秋风写于淄博 业务联系与技术交流:375172665

本文介绍了一种在QT C++环境中遍历图像矩阵,获取每个像素点RGB值的方法。通过双重循环,计算指定间隔内的像素点,提取其蓝色、绿色和红色分量,并进行累加求和。该代码片段展示了如何使用OpenCV的at函数来访问图像的像素值。
3239

被折叠的 条评论
为什么被折叠?



