如何得到两个连续帧的平均输出
How to get the average output of two consecutive frames?
我正在编写以下代码
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
int main()
{
VideoCapture *camera = new VideoCapture();
camera->open(0);
if(!camera->isOpened())
{
cout << "No Camera" << endl;
return -1;
}
Mat image,blur,image2;
namedWindow("Video");
while(true)
{
*camera>>image;
*camera>>image2;
//Show default image
imshow("Video",image);
if(waitKey(30)>=0)
{
break;
}
}
return 0;
}
我知道如果我设法得到连续两帧的平均输出,我可以将实时网络摄像机输出的视频减少70%。我用
得到了两个连续的帧 *camera>>image;
*camera>>image2;
现在,我如何得到它的平均值并显示它呢?
对于cv::Mat
,您可以这样做:
Mat img_mean=0.5*image+0.5*image2;
imshow("Average",img_mean);
相关文章:
- 递归函数计算序列中的平方和(并输出过程)
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 请解释"函数1(p1,p2,p3);"的输出
- C++:将控制台输出存储在宏中更好吗
- 创建一个函数以在输入为负数或零时输出字符串.第一次执行用户定义的函数
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- 模板元程序查找相似的连续类型名称
- 为什么我的代码在输出中增加了93天
- 如何从void函数输出字符串
- 输入到文件并输出到另一个文件,并将流文件传递给函数
- AES加密到解密未正确输出
- 如何将c++程序的一些输出传递给shell,以便在shell中使用
- 使用C++程序合并排序没有得到正确的输出
- 读取 Qt 中连续 QProcess 的标准输出
- 如何使用 C 连续输出自计算开始以来的秒数
- Linux将连续输出作为命令行参数传递
- 如何得到两个连续帧的平均输出
- 如何在输入和输出过程中连续闪烁特定的文本
- 二维数组输出一个连续的行
- 连续输出(最多)4 个矢量元素