我正在尝试从我的摄像头获取运行平均帧数,但几秒钟后,平均帧数的图像变得越来越亮,而且比白色更亮。
我的 cam 提供具有 3 个通道的灰度图像。我在 Windows 7,Visualstudio 2012,opencv 243
#include<opencv2\opencv.hpp>
#include<opencv2\core\core.hpp>
#include<opencv2\highgui\highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char* argv[])
{
VideoCapture cap(0);
Mat frame1;
cap.read(frame1);
Mat acc = Mat::zeros(frame1.size(), CV_32FC1);
while(1){
Mat frame;
Mat gray;
cap.read(frame);
cvtColor(frame ,gray ,CV_BGR2GRAY,0);
accumulateWeighted(gray, acc,0.005);
imshow("gray", gray);
imshow("acc", acc);
waitKey(1); //don't know why I need it but without it the windows freezes
}
}
谁能告诉我我做错了什么?谢谢!