【问题标题】:Why is OpenCV performing poorly on Raspberry Pi 3B+?为什么 OpenCV 在 Raspberry Pi 3B+ 上表现不佳?
【发布时间】: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;
}

【问题讨论】:

    标签: c++ opencv opencv3.0


    【解决方案1】:

    就像经常发生的那样,在提出问题并发布问题后,答案就变得显而易见了..

    问题是我的相机 v4l2-ctl 配置已在早期进行了一些修改,并且仍然处于活动状态,具有非常高的 exposure_absolute 设置,这限制了帧速率

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-04
      • 1970-01-01
      • 1970-01-01
      • 2019-07-17
      • 1970-01-01
      • 2022-07-17
      • 1970-01-01
      相关资源
      最近更新 更多