def get_region_label(lon, lat): map_src = r'/home/dlbox/Documents/func_region/Out/Map/Roadnet Pics/ccl.png' map_table = cv2.imread(map_src, 0) (coordX, coordY) = gps2xy(lon, lat) try: label = map_table[coordX, coordY] return label except IndexError: return -1
def get_region_label(lon, lat): map_src = Path( '/home/dlbox/Documents/func_region/Out/Map/Roadnet Pics/labeled_map.tiff' ) map_table = cv2.imread(str(map_src), 0) (coordX, coordY) = gps2xy(lon, lat) labels = np.zeros(lon.shape[0]) for k in range(len(coordX)): try: label = map_table[coordX[k], coordY[k]] labels[k] = label except IndexError: labels[k] = 0 return labels.astype(int)