Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from goprocam import GoProCamera
from goprocam import constants
gpCam = GoProCamera.GoPro()
TIMER=4
gpCam.downloadLastMedia(gpCam.take_photo(TIMER)) #take a photo in 4 seconds and download it.
def __init__(self, starting_led_index, total_leds, background_interval):
self.leds = []
self.starting_led_index = starting_led_index
self.background_interval = background_interval
self.total_leds = total_leds
self.cam = GoProCamera.GoPro()
'''
self.ser = serial.Serial(
port=SERIAL_PORT,
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
'''
self.clear_leds()
from goprocam import GoProCamera
from goprocam import constants
gpCam = GoProCamera.GoPro()
while True:
TIMER=10
gpCam.downloadLastMedia(gpCam.take_photo(TIMER)) #10 second timelapse.
import cv2 # importing Python OpenCV
from datetime import datetime # importing datetime for naming files w/ timestamp
import socket
from goprocam import GoProCamera
from goprocam import constants
from time import time
import argparse
gpCam = GoProCamera.GoPro()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
gp_sync_time=time()
gpCam.livestream("start")
ap = argparse.ArgumentParser()
ap.add_argument("-s", "--save_photo", action='store_true', help="Screenshot from opencv")
ap.add_argument("-p", "--take_photo", action='store_true', help="Take photos every time there is movement in the frame")
ap.add_argument("-r", "--record", action='store_true', help="Start recording after the first movement")
ap.add_argument("-t", "--tag", action='store_true', help="Hilight Tag on movements when recording")
ap.add_argument("-u", "--uri", help="Source URL")
args = ap.parse_args()
def diffImg(t0, t1, t2):
d1 = cv2.absdiff(t2, t1)
d2 = cv2.absdiff(t1, t0)
return cv2.bitwise_and(d1, d2)
window = "GoPro View"
import cv2
import numpy as np
from goprocam import GoProCamera
from goprocam import constants
cascPath="/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
gpCam = GoProCamera.GoPro()
#gpCam.gpControlSet(constants.Stream.BIT_RATE, constants.Stream.BitRate.B2_4Mbps)
#gpCam.gpControlSet(constants.Stream.WINDOW_SIZE, constants.Stream.WindowSize.W480)
cap = cv2.VideoCapture("udp://127.0.0.1:10000")
while True:
# Capture frame-by-frame
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
flags=cv2.CASCADE_SCALE_IMAGE
)
from goprocam import GoProCamera
import os
import time
from jpegtran import JPEGImage
camera = GoProCamera.GoPro()
if not os.path.isdir('images'):
os.mkdir('images')
for i in range(0,5):
folder = 'images/' + ['RTTY','APRS','LORA0','LORA1','FULL'][i]
if not os.path.isdir(folder):
os.mkdir(folder)
while True:
for i in range(0,5):
filename = 'take_pic_' + str(i)
if os.path.isfile(filename):
os.remove(filename)
os.chdir('images/' + ['RTTY','APRS','LORA0','LORA1','FULL'][i])
camera.downloadLastMedia(camera.take_photo(0))
os.chdir('../..')
from goprocam import GoProCamera
from goprocam import constants
gopro = GoProCamera.GoPro()
gopro.stream("udp://127.0.0.1:10000")
from goprocam import GoProCamera
from goprocam import constants
import time
gpCam = GoProCamera.GoPro()
print(gpCam.take_photo(10))