def __init__(self, black, scale, road): super().__init__() self.black = black self.rect = self.black self.scale = scale self.road = road self.player_index = (0,1) self.plate_box = np.array([ [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],#0 [0,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,0,1],#1 [1,1,1,0,1,0,0,0,0,0,1,1,0,1,1,1,0,1],#2 [1,1,1,0,0,0,1,1,1,0,0,1,0,0,0,0,0,1],#3 [1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1],#4 [1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1],#5 [1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,0,1],#6 [1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1],#7 [1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1],#8 [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1] #9 ]) self.plates = np.empty_like(self.plate_box,plate.Plate) k = 0 for i in range(420, 1500, 60): w = 0 for j in range(180, 780, 60): if(self.plate_box[w,k]==1): self.plates[w,k] = plate.Plate("black", i, j) else: self.plates[w,k] = plate.Plate("yellow", i, j) w = w + 1 k = k + 1
def detectCommand(self): self.pause = False self.suspend = False # it will wait until fronter feature is processed if self.lcMark.get() == 1: # license number check self.feature_queue.append( plate.Plate(position=self.UAV.region.center, log=self.log)) self.lcMark.set(0) if self.acMark.get() == 1: # annual mark check self.feature_queue.append(ancheck.Ancheck(log=self.log)) self.acMark.set(0)
def draw_labyrinth(): y = 0 rocks = [] for row in labyrinth: for x in range(len(row)): element = row[x] block_type = plate.Plate.WALL_SPRITE if element == 0 else plate.Plate.PATH_SPRITE if element == 0: rocks.append(pygame.Rect(x * 30, y * 30, 30, 30)) panel = plate.Plate((x * plate.Plate.SPRITE_SIZE[0], y * plate.Plate.SPRITE_SIZE[1]), block_type) panel.draw(SCREEN_BACKGROUND) y += 1 return rocks
annotator_type = appContext.getConfig('General', 'annotation_type') annotator = annotations.AnnotatorFactory.get_annotator(annotator_type) # Create output directory or clean it clear_output = appContext.getBoolean('General', 'clear_output') if not os.path.exists(output_path): os.makedirs(output_path) elif clear_output: files = glob.glob(os.path.join(output_path, '*')) for f in files: os.remove(f) for i in range(dataset_size): # Generate from random template plate_type = utils.get_random_item(templates) new_plate = plate.Plate(appContext, plate_type, templates[plate_type]) # Change perspective, size and background new_plate.random_resize() new_plate.image_data, new_plate.bounding_boxes = perspective.warp_image_random( new_plate.image_data, new_plate.bounding_boxes, appContext) new_plate.image_data, new_plate.bounding_boxes = scene.add_backgroud( new_plate.image_data, new_plate.bounding_boxes, appContext) # Generate annotation and image file annotator.append_annotation(new_plate) new_plate.save_image(output_path) time.sleep( 0.5 ) # TODO: Find solution for random images that are not written to disk
default=None, help= 'Mask for plants, should be an indexed png file with ascending indices.' ) args = vars(ap.parse_args()) logger = logging.getLogger('log') if not os.path.isdir(args['output_dir']): try: os.makedirs(args['output_dir']) except OSError: logger.critical('Could not create directory {}!'.format( args['block_output_dir'])) sys.exit(1) if not os.path.isfile(args['input_image']): logger.critical('Input image {} does not exist!'.format( args['input_image'])) sys.exit(1) ############################ Processing ############################# #pl = plate.Plate(plate_image='./input_images/plate10.jpg', plant_mask='./input_images/mask.png',output_dir='./processed_images', plate_id='plate10') pl = plate.Plate(plate_image=args['input_image'], plant_mask=args['mask'], output_dir=args['output_dir'], plate_id=args['plate_id']) pl.extract_plants_from_images() pl.save_everything() pl.segment_plants() pl.calc_area() pl.save_everything()
#Event loop for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: window_open = False elif event.type == pygame.QUIT: window_open = False #Micromouse movement Micromouse.get_event(event) #Draw labyrinth y = 0 for row in labyrinth: for x in range(len(row)): element = row[x] block_type = plate.Plate.WALL_SPRITE if element == 0 else plate.Plate.PATH_SPRITE if element == 0: rocks.append((x*30,y*30)) panel = plate.Plate((x * plate.Plate.SPRITE_SIZE[0], y * plate.Plate.SPRITE_SIZE[1]), block_type) panel.draw(SCREEN_BACKGROUND) y += 1 Micromouse.update() Micromouse.draw(SCREEN_BACKGROUND) pygame.display.update() print(rocks)
import worklist import plate #aspirate(1,"LC",[1,3,4],1,2,3,"wells") plate1 = plate.Plate("Samples", 4, 3, 12, 8) worklist.aspirate(7, ['B3', 'D3', 'E3'], "Water", [10, 20, 30], plate1) worklist.aspirate(7, ['B4', 'D4', 'F4'], "Water", [10, 20, 30], plate1) worklist.aspirate(1, ['B1'], "Water", [10], plate1) worklist.dispense(2, ['B1'], "Water", [10], plate1) worklist.mix(2, ['B1'], "Water", [10], plate1, 7) worklist.vector("ROMAVector", plate1, worklist.SAFETOEND, True, worklist.OPEN, worklist.CLOSE) worklist.execute("python test", True, "result") worklist.userprompt("Script done") worklist.dump()