def map_tags_hybrid3(self, pixelmap, C): tags = self.map_tags_camera() accepted = [] outside = [] bad = [] obs = self.source.get_loc_dict() for (tag, (_, pixel)) in tags: location = geom.picknearestll(pixelmap, tag) error = tag.xydistance(location) if error < 2.0: accepted.append((tag, (_, pixel))) elif error < 15.0 or not geom.contains(pixel, self.image.size): outside.append((tag, (_, pixel))) else: bad.append((tag, (999, pixel))) cell = util.getclosestcell(self.lat, self.lon, C.dbdir)[0] cellpath = os.path.join(C.dbdir, cell) pm = reader.get_reader(C.params['descriptor'])\ .load_PointToViewsMap(cellpath, C.infodir) for (tag, (_, pixel)) in outside: vis, t = pm.hasView(C, tag.lat, tag.lon,\ self.lat, self.lon, self.yaw, 25) emv = tag.emIsVisible(self.source, C, 25) if (vis or emv): if geom.norm_compatible(tag, self): accepted.append((tag, (_, pixel))) else: bad.append((tag, (12, pixel))) else: bad.append((tag, (15, pixel))) return accepted, bad
def map_tags_hybrid2(self, pixelmap, C): """Tags are filtered by using the image's pt cloud when source tag is visible in the db image. Otherwise, a combination of earthmine occlusion queries and database occlusion queries are performed.""" tags = self.map_tags_camera(self.lat, self.lon) accepted = [] outside = [] bad = [] THRESHOLD = 15 outside = tags # XXX # for (tag, (_, pixel)) in tags: # location = pixelmap[geom.picknearest(pixelmap, *pixel)] # if location is None: # if not geom.contains(pixel, self.image.size): # outside.append((tag, (_, pixel))) # else: # bad.append((tag, (999, pixel))) # else: # dist = tag.xydistance(location) # if dist < THRESHOLD: # accepted.append((tag, (_, pixel))) # elif not geom.contains(pixel, self.image.size): # outside.append((tag, (_, pixel))) # else: # bad.append((tag, (999, pixel))) cell = util.getclosestcell(self.lat, self.lon, C.dbdir)[0] cellpath = os.path.join(C.dbdir, cell) pm = reader.get_reader(C.params['descriptor'])\ .load_PointToViewsMap(cellpath, C.infodir) for (tag, (_, pixel)) in outside: vis, t = pm.hasView(C, tag.lat, tag.lon, self.lat, self.lon, self.yaw, 30) emv = tag.emIsVisible(self.source, C, 30) if (vis or emv): if geom.norm_compatible(tag, self): accepted.append((tag, (_, pixel))) else: bad.append((tag, (12, pixel))) else: bad.append((tag, (17, pixel))) return accepted + bad