0
votes

I just buy this : https://www.amazon.fr/gp/product/B08CGVSRQV/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 … I own a gopro3 and I would like to use it as webcam and work on it with opencv.

My system: gopro3 => microHDMI to HDMI => HDMI to USB3 (my purchase above) => my computer.

On Ubuntu, with this basic program:

#include <iostream>
#include <opencv4/opencv2/opencv.hpp>
#include <opencv4/opencv2/videoio.hpp>

using namespace cv;

int main() {
    VideoCapture vid(0);
    if (!vid.isOpened()) {...}

    Mat frame;
    for(;;) {
        vid >> frame; // get a new frame from camera
        imshow("edges", frame);
        if (waitKey(30) >= 0) break;
    }
    vid.release(); destroyAllWindows(); return 0;
}

A little window appears, about 800/600, and everything ok, good latence, good fps, bad quality but nothing strange. If I force 1920/1080:

vid.set(3, 1920);
vid.set(4, 1080);

I can see my video with a latency of about 1 second and maybe 5 fps;

I thought, maybe I have a problem with USB3 (for capture HDMI), but I try on "guvcview" which is limited to 30fps and everything ok (latency, fps, quality).

I don't know what to do to read my gopro with 1920/1080/60 with opencv (30fps should be good enough). Gopro is able to do 1920/1080/60, next cable too, capture card too, Ubuntu too ...

And maybe the problem is not opencv but Ubuntu configuration.

Any Idea ?

1

1 Answers

0
votes

I had the same Problem but on Windows. Specifying Video capture to use DSHOW solved the problem for me

cv::VideoCapture cap(0 + cv::CAP_DSHOW);

But unfortunadely as far as i know DSHOW is only for windows. But maybe this is a hind and you have to specify another API to use for reading the video stream.