How to use the goprocam.constants.Mode function in goprocam

To help you get started, we’ve selected a few goprocam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KonradIT / gopro-py-api / examples / opencv_gopro / motion_detection.py View on Github external
source = args.uri
cam = cv2.VideoCapture(source)
cv2.namedWindow(window)

t_minus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
t = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
t_plus = cv2.cvtColor(cam.read()[1], cv2.COLOR_RGB2GRAY)
timeCheck = datetime.now().strftime('%Ss')

def release():
  cv2.destroyAllWindows()
  cam.release()
  gpCam.shutter(constants.stop)
if args.take_photo:
  gpCam.shutter("stop")
  gpCam.mode(constants.Mode.PhotoMode, constants.Mode.SubMode.Photo.Single_H5)
while True:
  cv2.imshow(window, cam.read()[1] )
  if cv2.countNonZero(diffImg(t_minus, t, t_plus)) > threshold and timeCheck != datetime.now().strftime('%Ss'):
    dimg= cam.read()[1]
    print(datetime.now(), "Movement detected")
    if args.save_photo:
      cv2.imwrite(datetime.now().strftime('%Y%m%d_%Hh%Mm%Ss%f') + '.jpg', dimg)
    if args.take_photo:
      gpCam.shutter("stop")
      gpCam.take_photo()
    if args.record:
      if gpCam.IsRecording() == 0:
        gpCam.shoot_video()
    if args.record == True and args.tag == True:
      gpCam.hilight()
  timeCheck = datetime.now().strftime('%Ss')
github KonradIT / gopro-py-api / goprocam / GoProCamera.py View on Github external
def take_photo(self, timer=1):
        """Takes a photo. Set timer to an integer to set a wait time"""
        if "HERO5 Black" in self.infoCamera(constants.Camera.Name) or "HERO6" in self.infoCamera(constants.Camera.Name):
            self.mode(constants.Mode.PhotoMode,
                      constants.Mode.SubMode.Photo.Single_H5)
        else:
            self.mode(constants.Mode.PhotoMode)
        if timer > 1:
            print("wait " + str(timer) + " seconds.")
        time.sleep(timer)
        self.shutter(constants.start)

        if self.whichCam() == constants.Camera.Interface.GPControl:
            ready = int(self.getStatus(constants.Status.Status,
                                       constants.Status.STATUS.IsBusy))
            while ready == 1:
                ready = int(self.getStatus(constants.Status.Status,
                                           constants.Status.STATUS.IsBusy))
            return self.getMedia()
        elif self.whichCam() == constants.Camera.Interface.Auth:
            ready = str(self.getStatus(constants.Hero3Status.IsRecording))
            while ready == "01":
                ready = str(self.getStatus(constants.Hero3Status.IsRecording))
github KonradIT / gopro-py-api / goprocam / GoProCamera.py View on Github external
def take_photo(self, timer=1):
        """Takes a photo. Set timer to an integer to set a wait time"""
        if "HERO5 Black" in self.infoCamera(constants.Camera.Name) or "HERO6" in self.infoCamera(constants.Camera.Name):
            self.mode(constants.Mode.PhotoMode,
                      constants.Mode.SubMode.Photo.Single_H5)
        else:
            self.mode(constants.Mode.PhotoMode)
        if timer > 1:
            print("wait " + str(timer) + " seconds.")
        time.sleep(timer)
        self.shutter(constants.start)

        if self.whichCam() == constants.Camera.Interface.GPControl:
            ready = int(self.getStatus(constants.Status.Status,
                                       constants.Status.STATUS.IsBusy))
            while ready == 1:
                ready = int(self.getStatus(constants.Status.Status,
                                           constants.Status.STATUS.IsBusy))
            return self.getMedia()
        elif self.whichCam() == constants.Camera.Interface.Auth:
            ready = str(self.getStatus(constants.Hero3Status.IsRecording))