【发布时间】:2018-07-11 13:16:00
【问题描述】:
在 Raspberry Pi 3B+(Arm 处理器)上运行
OpenCV C++ 3.4 静态库从源代码构建的库带有相关标志-DENABLE_NEON=ON -DCMAKE_BUILD_TYPE=Release -DWITH_V4L=ON
使用基本的 ELP USB 网络摄像头(不使用 raspi 摄像头,因为我最终想要多个摄像头)
这个捕获和渲染帧的基本程序正在获得大约 2 或 3 FPS 的速度。这简直是不可能的!
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/shape.hpp>
#include <iostream>
#include <stdarg.h>
#include <thread>
#include "time.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv ) {
VideoCapture cap(0);
cap.set(CAP_PROP_FRAME_WIDTH, 320);
cap.set(CAP_PROP_FRAME_HEIGHT, 240);
cap.set(CAP_PROP_FPS, 30);
cap.set(CAP_PROP_FOURCC, CV_FOURCC('M','J','P','G'));
long startMs = timeMs();
int count = 0;
for(;;) {
Mat frame;
cap >> frame;
imshow("Camera", frame);
if (++count == 30) {
long elapsedMs = (timeMs() - startMs);
double fps = count * 1000.0 / elapsedMs;
cout << "FPS: " << fps << endl;
startMs = timeMs();
count = 0;
}
waitKey(1);
}
return 0;
}
【问题讨论】: