Skip to content
This repository was archived by the owner on Mar 2, 2025. It is now read-only.

Commit 2e94115

Browse files
author
Konrad Iturbe
committed
Add examples for webcam
1 parent 0249e07 commit 2e94115

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
import time
3+
from goprocam import GoProCamera, constants
4+
import threading
5+
6+
7+
def take_photo(interface):
8+
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
9+
interface), camera=constants.gpcontrol, webcam_device=interface)
10+
while True:
11+
gopro.take_photo()
12+
time.sleep(2)
13+
print("Photo taken")
14+
15+
16+
cameras = sys.argv[1]
17+
cameras = cameras.split(",")
18+
19+
for interface in cameras:
20+
thr = threading.Thread(target=take_photo, args=(interface,))
21+
thr.start()

examples/launch_webcam_preview.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
from signal import signal, SIGINT
22
from goprocam import GoProCamera, constants
3+
import sys
4+
5+
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP(
6+
sys.argv[1]), camera=constants.gpcontrol, webcam_device=sys.argv[1])
7+
38

49
def handler(s, f):
510
gopro.stopWebcam()
611
quit()
712

13+
814
signal(SIGINT, handler)
915

10-
gopro = GoProCamera.GoPro(ip_address=GoProCamera.GoPro.getWebcamIP())
11-
gopro.startWebcam(constants.Webcam.Resolution.R720p)
16+
# gopro.startWebcam(constants.Webcam.Resolution.R720p)
1217
gopro.webcamFOV(constants.Webcam.FOV.Linear)
1318
gopro.getWebcamPreview()
1419
gopro.KeepAlive()

0 commit comments

Comments
 (0)