def got_camera(c): global cam cam = c if cam is None: print("no cam connected") edsdk.terminate() else: print("taking picture") cam.setPictureCompleteCallback(pic_taken) cam.takePicture("C:\\test.jpg")
def run_live_view_thread(): debug("camera.startLiveView()") global camera camera.startLiveView() camera.grabLiveViewFrame() debug("entering loop to send live view frames") global finished while not finished: if motors is None: motor_positions = {char: 0 for char in motor_chars} motor_states = {char: 0 for char in motor_chars} else: motor_positions = {char: motor.position() for char, motor in motors.items()} motor_states = {char: int(motor_is_initialized[char]) for char, motor in motors.items()} server.send_message(FullUpdate(camera.liveViewMemoryView(), motor_positions, motor_states)) camera.grabLiveViewFrame() time.sleep(0.20) # shut down the camera camera.disconnect() camera = None edsdk.terminate()
def pic_taken(filename): print("got picture: " + filename) global cam cam.disconnect() edsdk.terminate()