def shoot_panorama(camera, motors, shots=5): s = 1 im = IMR.Imager(image=camera.update()).scale(s, s) rotation_time = 3 / shots # At a speed of 0.5(of max), it takes about 3 seconds to rotate 360 degrees for i in range(shots - 1): motors.right(0.5, rotation_time) im = im.concat_horiz(IMR.Imager(image=camera.update())) return im
def shoot_panorama(shots=5): camera = Camera() motors = Motors() s = 1 im = IMR.Imager(image=camera.update()).scale(s, s) rotation_time = 3 / shots # At a speed of 0.5(of max), it takes about 3 seconds to rotate 360 degrees for i in range(shots - 1): motors.right(0.5, rotation_time) im = im.concat_horiz(IMR.Imager(image=camera.update())) im.dump_image("/root/Oving6_Plab/basic_robot/bilder/test.png") return im
def sense_and_act(self): """ Rød: Snu venstre Grønn: Snu høyre """ if self.picture_taken == True: self.motor_recs = ('S', 0) self.weight = 1 else: print('Tar bildet.') im = IMR.Imager(image=self.sensor.update()).scale(1, 1) im.dump_image('tatt_bilde.jpeg') color = self.sensor.get_color() print("Test color:", color) self.match_degree = 1 self.weight = 1 if color == 'red': self.motor_recs = ('L', 90) elif color == 'green': self.motor_recs = ('R', 90) else: self.motor_recs = ('L', 180) self.halt_request = True # Stopper hele testen dersom self.picture_taken = True self.bbcon.active_count = False # Stopp hele programmet
def sense_and_act(self): if self.active_flag: im = IMR.Imager(image=self.sensob.get_value()) im.dump_image('garbage'+str(self.photo_count)+'.jpeg') self.photo_count += 1 self.match_degree = 0 else: self.match_degree = 1
def sense_and_act(self): #When zumo is within 10cm of an object take_photo should have greater weight if not self.bbcon.picture_taken and self.active_flag: im = IMR.Imager(image=self.sensob.get_value()[0]) print("TAKING PHOTO") im.dump_image('garbage' + str(self.photo_count) + '.jpeg') self.photo_count += 1 self.bbcon.picture_taken = True self.motor_recommendations = [["f", 0, 0.1]] self.match_degree = 0
def __init__(self): super(DuckFinder, self).__init__() self.width = 48 self.height = 36 self.sensor = Camera(img_width=self.width, img_height=self.height) # os.system('rm -f image.png') self.value = None self.K = 12 self.imager = IMR.Imager(width=self.width, height=self.height) self.interpretation = 2.0
def sense_and_act(self): im = self.sensor.get_value() im = IMR.Imager(image=im).scale(3, 3) im.dump_image("test.jpeg") #im.display() if im.blackboi(): print("pic is dark!") self.motor_recommendation = ['B', 20] self.match_degree = 1 else: print("pic is bright") self.motor_recommendation = ['S', 0] self.match_degree = 0.02
def duck_color(): width = 48 height = 36 camera = Camera(img_width=width, img_height=height) button = ZumoButton() while True: button.wait_for_press() image = IMR.Imager(image=camera.update()) rgb_table = [[image.get_pixel(x, y) for y in range(0, height)] for x in range(0, width)] for i in range(0, width): for j in range(0, height): print(rgb_table[i][j], end=" ") print() print()
def __init__(self): self.cam = Camera() self.im = IMR.Imager("bilder/bilde.png") self.s = 1
def takePic(self): return IMR.Imager(image=self.cam.update().scale(self.s, self.s))
def takePic(self): im = IMR.Imager(image=self.cam.update()).scale(self.s, self.s) #im.dump_image("/root/Oving6_Plab/basic_robot/bilder/bilde.png") return im
def snap(self): return IMR.Imager(image=self.cam.update())
def cameraTest(): camera = Camera() s = 1 im = IMR.Imager(image=camera.update()).scale(s, s) im.dump_image("/root/Oving6_Plab/basic_robot/bilder/test2.png")
def __init__(self, sensor): Sensob.__init__(self, sensor) self.direction = 0 self.sensor.img_width = 90 self.sensor.img_height = 40 self.imager = imager2.Imager(False, False, self.sensor.img_width, self.sensor.img_height)