def __init__(self, offsite=False): """ Measurement sequence class Parameters ---------- offsite: bool, optional Determines if the system is operating with a connected setup or simulating the process from previously captured images """ self.offsite = offsite print(_C.CYAN + _C.BOLD + 'Initializing sequence' + _C.ENDC) if self.offsite: self.prime = self._placeholder self.disable = self._placeholder self.calibrate = self.calibrateOffsite self.evaluate = self.evaluateOffsite self.measure = self.measureOffsite else: self.cam = Camera() if not self.cam.camera_available: print(_C.RED + 'No camera connected. Check USB and power connection.' + _C.ENDC) sys.exit() self.stp = Stepper(autoEnable=False) print(_C.LIME + 'Ready for priming' + _C.ENDC) self.primed = False
def __init__(self): self.rear_motor = Motor(motor_type="rear_motor") self.front_motor = Motor(motor_type="front_motor") self.front_right_blinker = Blinker(7) self.fron_left_blinker = Blinker(11) self.range_sensor = RangeSensor() self.camera = Camera()
def __init__(self, engine): """ engine is an instance of the Engine object that controls the hardware of the raspberry pi. """ self.created = time.time() self.engine = engine # Number of times a move command has been issued self.moves = 0 # What times move commands were issued at self.moves_times = [] # Camera control self.camera = Camera(flip_vertical=True, width=320, height=240)
def main(args): cam = Camera(1) projector = Projector(1) projector.load_configuration(args.calibration_path) segmenter_brain = DeeplabImageSegmenter.from_path(args.segment_path, args.segment_map) detector_brain = None # ObjectDetector.from_path(args.detector_path, args.detector_labels) device = Device(args.device_port) demo = Demo(camera=cam, projector=projector, segmentation_brain=segmenter_brain, detector_brain=detector_brain, device=device) demo.run()
def __init__(self): self.rear_motor = Motor(motor_type="rear_motor") self.front_motor = Motor(motor_type="front_motor") self.range_sensor = RangeSensor() self.camera = Camera()
help="The path/filename to save the config *.json to.") parser.add_argument("-c", "--cam-id", type=int, required=True, help="The camera ID (must be integer > 0)") parser.add_argument("-p", "--projector-id", type=int, required=True, help="The monitor ID representing the projector. " "Try numbers 0-# monitors, if you don't know.") args = parser.parse_args() p = Projector(args.projector_id) c = Camera(1) factory = SurfaceFactory(c, p) print(intro_text) input() while True: new_surface = factory.create_surface() p.surfaces.append(new_surface) ans = "" while "y" not in ans.lower() and "n" not in ans.lower(): ans = input("Would you like to create another surface? (y/n)") if "n" in ans.lower(): break p.save_configuration(args.save_to)
def test_resolution(self): camera = Camera(width=999, height=999) self.assertEqual(camera.width, 999) self.assertEqual(camera.height, 999)
def test_frame(self): camera = Camera() self.assertEqual(camera.frame, None, 'frame is defined before data acquired')
from examples import demos from hardware.camera import Camera from hardware.projector import Projector """ This is a quick example on how to run a demo from the demos module """ # Open a camera cam = Camera(0) # Calibrate the projector projector = Projector(2) projector.load_configuration("../projector-config.json") # Run the demo of your choice # demos.draw_edged(cam, projector) # demos.draw_pointer(cam, projector) # demos.draw_edged_snapshot(cam, projector) demos.draw_inverted(cam, projector)