def connect(self): print_notification("Opening camera") if self.file == "": while not self.halt: try: self.cap = self.manager.open_camera() self.cap.setUseCase(self.mode) self.cap.setExposureTime(self.exposure) sample_camera_info.print_camera_info(self.cap) print("isConnected", self.cap.isConnected()) print("getFrameRate", self.cap.getFrameRate()) break except RuntimeError as e: print_warning('Exception was thrown: {}'.format(e)) print_notification( 'Is the camera connected? Trying for a recording instead.' ) if get_yes_no( "Would you like to open a recording?", "If you select yes, you will be prompted to select a video file", parent=self.parent): self.file = get_filename( "Select a .rrf file to open", "Royale Recording File (*.rrf)") self.connect() break else: print_notification("Retrying") else: self.cap = self.manager.open_recording(self.file) self.cap.registerDataListener(self.listener) self.isConnected = True
def main (): platformhelper = PlatformHelper() parser = argparse.ArgumentParser (usage = __doc__) add_camera_opener_options (parser) parser.add_argument ("--frames", type=int, required=True, help="duration to capture data (number of frames)") parser.add_argument ("--output", type=str, required=True, help="filename to record to") parser.add_argument ("--skipFrames", type=int, default=0, help="frameSkip argument for the API method") parser.add_argument ("--skipMilliseconds", type=int, default=0, help="msSkip argument for the API method") options = parser.parse_args() opener = CameraOpener (options) cam = opener.open_camera () print_camera_info (cam) l = MyListener() cam.registerRecordListener(l) cam.startCapture() cam.startRecording (options.output, options.frames, options.skipFrames, options.skipMilliseconds); seconds = options.frames * (options.skipFrames + 1) / cam.getFrameRate() if options.skipMilliseconds: timeForSkipping = options.frames * options.skipMilliseconds / 1000 seconds = int (max (seconds, timeForSkipping)) print ("Capturing with the camera running at {rate} frames per second".format (rate=cam.getFrameRate())) print ("This is expected to take around {seconds} seconds".format (seconds=seconds)) l.waitForStop() cam.stopCapture()
def main(): platformhelper = PlatformHelper() parser = argparse.ArgumentParser(usage=__doc__) add_camera_opener_options(parser) parser.add_argument("-s", "--seconds", type=int, default=15, help="duration to capture data") parser.add_argument("-n", "--name", type=str, default='MODE_5_45FPS_500', help="mode name") options = parser.parse_args() opener = CameraOpener(options) cam = opener.open_camera() cam.setUseCase(options.name) print_camera_info(cam) print("isConnected", cam.isConnected()) print("getFrameRate", cam.getFrameRate()) # we will use this queue to synchronize the callback with the main # thread, as drawing should happen in the main thread q = queue.Queue() xq = queue.Queue() yq = queue.Queue() l = MyListener(q, xq, yq) cam.registerDataListener(l) cam.startCapture() # create a loop that will run for a time (default 15 seconds) process_event_queue(q, xq, yq, l, options.seconds) cam.stopCapture()
def main (): try: rospy.init_node('pico_flexx') r = rospy.Rate(10) parser = argparse.ArgumentParser (usage = __doc__) add_camera_opener_options (parser) parser.add_argument ("--seconds", type=int, default=15, help="duration to capture data") options = parser.parse_args() opener = CameraOpener (options) cam = opener.open_camera () print_camera_info (cam) print("isConnected", cam.isConnected()) print("getFrameRate", cam.getFrameRate()) # we will use this queue to synchronize the callback with the main # thread, as drawing should happen in the main thread q = queue.Queue(maxsize=0) l = MyListener(q) cam.registerDataListener(l) cam.startCapture() while not rospy.is_shutdown(): r.sleep() cam.stopCapture() except rospy.ROSInterruptException: pass
def flexx(args): opener = CameraOpener(args) cam = opener.open_camera() print_camera_info(cam) cam.setUseCase(args.name) print("isConnected", cam.isConnected()) print("getFrameRate", cam.getFrameRate()) g = queue.Queue(args.queues) # Gray image Queue z = queue.Queue(args.queues) # Depth image Queue l = MyListener(g, args.mode, z) # Listener cam.registerDataListener(l) # Regist Listener #cam.startCapture() # start flexx process_event_queue(cam, g, args, z) # camera loop with Inference
def connect(self): print_notification("Opening camera") if self.file == "": while not self.halt: try: self.cap = self.manager.open_camera() self.cap.setUseCase(self.mode) self.cap.setExposureTime(self.exposure) sample_camera_info.print_camera_info(self.cap) print("isConnected", self.cap.isConnected()) print("getFrameRate", self.cap.getFrameRate()) break except RuntimeError as e: print_warning('Exception was thrown: {}'.format(e)) print_notification('Is the camera connected?') input("Press any key to continue") print_notification("Retrying") else: self.cap = self.manager.open_recording(self.file) self.cap.registerDataListener(self.listener) self.isConnected = True