Skip to content

Commit

Permalink
Add examples for webcam
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad Iturbe committed Oct 24, 2020
1 parent 0249e07 commit 2e94115
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
21 changes: 21 additions & 0 deletions examples/hero9-take-photo-webcam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sys
import time
from goprocam import GoProCamera, constants
import threading


def take_photo(interface):
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
interface), camera=constants.gpcontrol, webcam_device=interface)
while True:
gopro.take_photo()
time.sleep(2)
print("Photo taken")


cameras = sys.argv[1]
cameras = cameras.split(",")

for interface in cameras:
thr = threading.Thread(target=take_photo, args=(interface,))
thr.start()
9 changes: 7 additions & 2 deletions examples/launch_webcam_preview.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from signal import signal, SIGINT
from goprocam import GoProCamera, constants
import sys

gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
sys.argv[1]), camera=constants.gpcontrol, webcam_device=sys.argv[1])


def handler(s, f):
gopro.stopWebcam()
quit()


signal(SIGINT, handler)

gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP())
gopro.startWebcam(constants.Webcam.Resolution.R720p)
# gopro.startWebcam(constants.Webcam.Resolution.R720p)
gopro.webcamFOV(constants.Webcam.FOV.Linear)
gopro.getWebcamPreview()
gopro.KeepAlive()

0 comments on commit 2e94115

Please sign in to comment.