0

Visual Studio and opencv are using versions 2019 and 4.4.0

GoPRO HERO 7 BLACK is connected to PC using USB-C.

I try to open the cam using VideoCapture(), but it is not opened.

Below is the code are using.

#include <opencv2\opencv.hpp>
#include <opencv2\highgui.hpp>
#include <opencv2\core.hpp>
#include <opencv2\imgproc.h>>
using namespace cv;
using namespace std;

int main(void) {
   VideoCpature webcam_01(0);
   if(!webcam_01.isOpened()) {
      cout << "Cam opened error" << endl;
      return -1; }

   while(1) {
      Mat frame;
      webcam_01.read(frame);
      if(frame.empty()) {
        cout << "frame empty" << endl;
        break;
      }
      imshow("img", frame);
  }
  return 0;
}
Geun Mo Lee
  • 111
  • 2
  • 12
  • 1
    You can't access Gopro like a usb webcam ... you'll need to stream using https://pypi.org/project/goprocam/ and read that stream address using VideoCpature ("Stream__address") – Ziri Aug 27 '20 at 07:42
  • Thank you for your answer. Is there a website where I can get a simple example of streaming to a pypi? – Geun Mo Lee Aug 27 '20 at 08:04
  • Check out this answer: https://stackoverflow.com/questions/36112313/how-connect-my-gopro-hero-4-camera-live-stream-to-opencv-using-python – Ziri Aug 27 '20 at 08:07
  • How you cant open? Do you get any errors? Does it output as "Cam opened error" ? – Yunus Temurlenk Aug 27 '20 at 08:20
  • An error occurred in the part "if (!webcam_01.isOpen()". "Camera Opened Error" message will be printed. – Geun Mo Lee Aug 27 '20 at 08:23
  • This camera is not a webcam. It has its own sdk you cant open it like this. Check [here](https://stackoverflow.com/questions/36112313/how-connect-my-gopro-hero-4-camera-live-stream-to-opencv-using-python). – Yunus Temurlenk Aug 27 '20 at 08:26
  • Can VideoCapture() is open only usb webcam? – Geun Mo Lee Aug 27 '20 at 08:30
  • 1
    VideoCapture opens webcam and some usb cameras. The cameras ,which has their own software developement kit(SDK) or has their own api, VideoCapture cant open them – Yunus Temurlenk Aug 27 '20 at 09:38

0 Answers0