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_hybrid(self, pixelmap, C, elat, elon): """Uses tag projection from estimated lat, lon. Tags are filtered by using the image's pt cloud when source tag is visible in the db image. Otherwise, 3d occlusion detection is performed.""" THRESHOLD = 15.0 # meters tags = self.map_tags_camera(elat, elon) accepted = [] outside = [] bad = [] 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))) # use ocs method for tags outside db image cell = util.getclosestcell(self.lat, self.lon, C.dbdir)[0] cellpath = os.path.join(C.dbdir, cell) tree3d = reader.get_reader(C.params['descriptor']).load_tree3d(cellpath, C) for (tag, (d, pixel)) in outside: # if tag.isVisible2(self.source, tree3d, elat, elon): # accepted.append((tag, (_, pixel))) # else: # bad.append((tag, (15, pixel))) accepted.append((tag, (d, pixel))) return accepted + bad