Skip to content

Commit

Permalink
Add ffmpegless-opencv
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradIT committed May 4, 2017
1 parent 0ca38bc commit 5581dc4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/opencv_gopro/ffmpegless-preview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#This is the script without the need of a FFmpeg installation, pure OpenCV
#This is not useful for image processing (eg: find faces) as there will be more lag, around 6 seconds added.
import cv2
import numpy as np
from time import time
import socket
from goprocam import GoProCamera
from goprocam import constants
gpCam = GoProCamera.GoPro()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
t=time()
gpCam.livestream("start")
cap = cv2.VideoCapture("udp://10.5.5.9:8554")
while True:
nmat, frame = cap.read()
cv2.imshow("GoPro OpenCV", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
if time() - t >= 2.5:
sock.sendto("_GPHD_:0:0:2:0.000000\n".encode(), ("10.5.5.9", 8554))
t=time()
# When everything is done, release the capture
cap.release()
cv2.destroyAllWindows()

0 comments on commit 5581dc4

Please sign in to comment.