How connect my GoPro Hero 4 camera live stream to openCV using Python?

Viewed 17309

I 'm having troubles trying to capture a live stream from my new GoPro Hero 4 camera and do some image processing on it using openCV.

Here is my trial (nothing shows up on the created window

import cv2
import argparse
import time
import datetime
from goprohero import GoProHero


ap = argparse.ArgumentParser()
ap.add_argument("-a", "--min-area", type=int, default=500, help="minimum    area size")
args = vars(ap.parse_args())

camera = cv2.VideoCapture("http://10.5.5.9:8080/gp/gpControl/executep1=gpStream&c1=restart")
time.sleep(5)

cv2.namedWindow("", cv2.CV_WINDOW_AUTOSIZE)

firstFrame = None
noOfCars = 0
speed = 80

while True: 
    (grabbed, frame) = camera.read()
    text = "Smooth"
    print("Capturing ...")

    if not grabbed:
        print("nothing grabbed")
        break

the loop breaks as grabbed always equals false which means openCV got nothing.

2 Answers
Related