def define_ROI_polygons(w, h, crop_regions): ''' # Create dummy edges for placement # Note this assumes we will be using a SQUARE region of interest -- not true in general. Usage: w = image_size.width; h = image_size.height crop_region = (0.2,0.1,.2,.1) # % to crop left, crop right, crop top, crop bot surface_ROI, list_of_edges = define_ROI_polygons(w, h, crop_region) pc.scan_dataset.polygons.append(surface_ROI) for p in list_of_edges: pc.scan_dataset.polygons.append(p) ''' (left, right, top, bottom) = crop_regions width_min = w * left width_max = w * (1-right) height_min = h * top height_max = h * (1-bottom) p = label_object() p.set_label('surface') p.add_point((width_min,height_min)) p.add_point((width_min,height_max)) p.add_point((width_max,height_max)) p.add_point((width_max,height_min)) table_surface = p #A polygon shape (rectangle) defining most generous guess of table surface. print 'surface',p.get_points() p = label_object() p.set_label('edge_down') p.add_point((width_min,height_min)) p.add_point((width_min,height_max)) p.add_point((width_max,height_max)) p.add_point((width_max,height_min)) p.add_point((width_min,height_min)) list_of_edges = (p,) # [Above] Any number of polygons which define surface border. More can be added. print 'edge',p.get_points() return table_surface, list_of_edges
def __init__(self): """ Constructor """ self.dict = {} self.dict["title"] = "" self.dict["id"] = "" self.dict["polygons"] = [label_object.label_object()] self.dict["scan_filename"] = "" self.dict["image_filename"] = "" self.dict["image_artag_filename"] = "" self.dict["surface_id"] = "" self.dict["surface_height"] = "" self.dict["camera_height"] = "" self.dict["camera_angle"] = "" self.dict["surface_type"] = "" self.dict["ground_plane_normal"] = "" self.dict["ground_plane_three_points"] = "" self.dict["is_training_set"] = False self.dict["is_test_set"] = False self.dict["is_labeled"] = False self.dict["ground_plane_rotation"] = ""
def start_new_polygon(self): if False == self.polygons[self.current_polygon_index].is_empty(): # if self.current_polygon_index == len(self.polygons) - 1: self.polygons.append( label_object.label_object()) #last one, append new self.current_polygon_index = len(self.polygons) - 1 print "new poly index: ", self.current_polygon_index
def __init__(self): ''' Constructor ''' self.dict = {} self.dict['title'] = '' self.dict['id'] = '' self.dict['polygons'] = [label_object.label_object()] self.dict['scan_filename'] = '' self.dict['image_filename'] = '' self.dict['image_artag_filename'] = '' self.dict['surface_id'] = '' self.dict['surface_height'] = '' self.dict['camera_height'] = '' self.dict['camera_angle'] = '' self.dict['surface_type'] = '' self.dict['ground_plane_normal'] = '' self.dict['ground_plane_three_points'] = '' self.dict['is_training_set'] = False self.dict['is_test_set'] = False self.dict['is_labeled'] = False self.dict['ground_plane_rotation'] = ''
def start_new_polygon(self): if False == self.polygons[self.current_polygon_index].is_empty(): # if self.current_polygon_index == len(self.polygons) - 1: self.polygons.append(label_object.label_object()) #last one, append new self.current_polygon_index = len(self.polygons) - 1 print "new poly index: ", self.current_polygon_index
* pc.image_labels * pc.img_mapped * pc.img_mapped_polygons * testresults #Not sure what this is? * data_idx #indexes taken from pts3d_bound ONLY where label is nonzero * data #3d values of pts3d_bound where label is nonzero... # However as a list so 3x longer. * scan_indices - an artifact from the hokuyo. Original acquired line order? ''' if False: ####### Placement routine. object_height = 0.1 #SCALE = 1 resolution = [.01*SCALE, .01*SCALE] #sets resolution of occupancy grid print 'NOTE: Resolution is ',100*resolution[0], 'cm' ### polygon = label_object() polygon.add_point([0,0]) polygon.add_point([0,5*SCALE]) polygon.add_point([10*SCALE,5*SCALE]) polygon.add_point([10*SCALE,0]) ###object_height = 0.1 print 'creating placement object' pl = Placement(pc, resolution) ###REPLACE WITH MY OWN CLASS DEFINITION WITH FUNCTIONs if displayOn: placement_point = pl.test_placement(polygon, object_height) else: placement_point = pl.find_placement(polygon, object_height)#Add param True to get debug popups placement_point -= pc.scan_dataset.ground_plane_translation