Пример #1
0
 def __init__(self, password='******'):
     # the password is for my GoPro camera
     # creates an instance of the camera
     self.camera = GoProHero(password)
     self.status = dict()
     self.setting = dict()
     self.videoAddress = []
     self.imageAddress = []
     self.images = []
     self.videos = []
     self.imageNames = []
     self.images = []
     # updates the media list on the camera
     GoProCamera.statusUpdate(self)
Пример #2
0
def main_loop():
    global camera
    camera = GoProHero(password=GOPRO_PASS)

    # Record a 5 second test video, just to signal the user that
    # Raspberry Pi has booted up and that this program is running. This is useful
    # as feedback, when your Pi is not connected to a monitor or a terminal
    #
    print "Motion video trap reporting for duty. Your camera should take a test video now..."
    start_recording()
    time.sleep(5)
    stop_recording()

    # Start monitoring GPIO pin for a rising edge
    start_gpio_monitor()

    # Loop forever
    print "Starting main loop..."
    while True:
        time.sleep(10)
Пример #3
0
from goprohero import GoProHero
import time
camera=GoProHero(password='******')
camera.command('record', 'on')
time.sleep(120)
camera.command('record','off')

    frame = np.array(pilImage)
    return frame


def findTheDot(theframe):
    imgray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    _, thresh = cv2.threshold(imgray, 240, 255, cv2.THRESH_BINARY)

    ctrs, hier = cv2.findContours(thresh, cv2.RETR_TREE,
                                  cv2.CHAIN_APPROX_SIMPLE)
    cv2.drawContours(thresh, ctrs, -1, (255, 255, 255), 3)
    cv2.imshow('threshold', thresh)
    return ctrs


camera = GoProHero(password='******')
camera.command('fov', '90')
#camera.command('mode','still')
camera.command('picres', '12MP wide')
#camera.command('record','off')

while True:
    frame = getFrame()

    h, w = frame.shape[:2]
    ref = h / 2
    ctrs = findTheDot(frame)

    if len(ctrs) <= 0:
        print "Contours not found!"
        continue
Пример #5
0
from goprohero import GoProHero
import cv2
camera = GoProHero(password='******')
while True:
    frame = camera.image()
    cv2.imwrite("live.jpg", frame)
Пример #6
0
        url + '/' + node.get('href') for node in soup.find_all('a')
        if node.get('href').endswith(ext)
    ]


url = 'http://10.5.5.9:8080/videos/DCIM/100GOPRO/'
ext = 'MP4'
password = '******'

print "Clicking photos; connecting to gopro..."

os.system('wpa_cli select_network 1')

time.sleep(13)

camera = GoProHero(password=password)

for x in xrange(10):
    camera.command('record', 'on')
    time.sleep(1)  # delays for 1 second
    camera.command('record', 'off')

    time.sleep(1)  # delays for 1 second

    file_list = listFD(url, ext)
    video_url = file_list[-1]

    cap = cv2.VideoCapture(video_url)

    t = datetime.datetime.now().strftime("%d_%B_%Y_%I:%M:%S%p")
Пример #7
0
import numpy as np
import cv2
import subprocess as sp

from goprohero import GoProHero

camera = GoProHero(password='******')
#camera.command('record', 'on')
#status = camera.status()

#camera.command('power', 'on')
camera.command('mode', 'still')
#camera.command('mode', 'video')
camera.command('picres', '5MP wide')
#camera.command('vidres', '720p')
#camera.command('vidres', '960p')
camera.command('vidres', '1080p')
#camera.command('fov', '90')
#status = camera.status()
#password = camera.password()
image = camera.image()
Пример #8
0
 def __init__(self, passwd):
     self.camera = GoProHero(password=passwd, log_level=logging.CRITICAL)
Пример #9
0
#    print (dir(h4))
#    h4._autoconfigure()
#    h4.watch_status()



""" 2 GOPROMODULE """
#from gopro import GoPro #library files are not updated for python 3!!!



""" 3 GOPROHERO MODULE """
from goprohero import GoProHero 
#works, but some functions are outdated ... it also has 2 complementary modules
#goprocontroller and goprocontrollerui to use multiple cameras!!!!  
camera = GoProHero(password='******')
camera._ip
#test(http://10.5.5.9/camera/sd)
#camera.image()
#image capture is producing the error 
#"warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578)"
#but I used a test file in python and the ffmpeg codec seems to be ok.

#camera.command('power', 'sleep')
#camera.command('power', 'on')
#camera.command('record', 'on')
#cv2.waitKey(5000)
#camera.command('record', 'off')
#status = camera.status()

Пример #10
0
 def test_camera_init(self):
     # initialize a camera object
     camera = GoProHero('password')
     self.assertTrue(camera is not None)
Пример #11
0
# import numpy as np
# import cv2
# import json
import subprocess as sp
from goprohero import GoProHero
import urllib
from time import sleep

camera = GoProHero(password='******')
camera.command('power', 'on')
sleep(5)  #wait for camera to finish powering on
# TODO: check status for camera ready instead of just sleeping
# status = camera.status()
camera.command('preview', 'on')
camera.command('mode', 'still')
# TODO: See if we can set the picture resolution
# camera.command('picres', '8MP med')
startingimgnum = 2448  #This number needs to be set every time the program runs

while True:
    camera.command('record', 'on')
    sleep(1.5)  # wait for the gopro to save the picture
    filename = "{0}.jpg".format(startingimgnum)
    url = "http://10.5.5.9:8080/videos/DCIM/102GOPRO/GOPR{0}.JPG".format(
        startingimgnum)
    urllib.urlretrieve(url, filename)
    sleep(5)
    sp.call(["target_spotter", filename])
    startingimgnum = startingimgnum + 1

# statusJson = json.loads(status)
Пример #12
0
def recording(enable):
    rospy.loginfo('Set video enable {0}'.format(enable))
    camera = GoProHero(password='******')
    camera.command('record', 'on' if enable else 'off')
Пример #13
0
from dotenv import load_dotenv
import os
import schedule
import time
from goprohero import GoProHero

localtime = time.asctime(time.localtime(time.time()))
print(localtime, "I set up camera...")
load_dotenv()
your_password = os.getenv("KEY")
camera = GoProHero(password=your_password)
print(localtime, "I did set up camera...")


def job():
    print(localtime, "I'm working...")
    print(localtime, "I'm doing job...")
    camera.command('power', 'on')
    time.sleep(30)
    camera.command('record', 'on')
    time.sleep(7200)
    camera.command('record', 'off')
    camera.command('power', 'sleep')
    print(localtime, "I did job...")


schedule.every().day.at("05:30").do(job)

while True:
    schedule.run_pending()
    time.sleep(1)