Open Cram3r95 opened 2 years ago
You can use the following code for it.
grid_pts = get_mesh_grid_as_point_cloud(orig_bbox[0], orig_bbox[1], orig_bbox[2], orig_bbox[3])
grid_pt_labels = self.avm.get_raster_layer_points_boolean(grid_pts, city, layer_name='driveable_area')
grid_pts = grid_pts.reshape(int(orig_bbox[3] - orig_bbox[2]) + 1, -1, 2)
grid_pt_labels = grid_pt_labels.reshape(int(orig_bbox[3] - orig_bbox[2]) + 1, -1)
grid_pt_labels = ~np.flip(grid_pt_labels, axis=0)
""" Plot driveable area """
if debug:
plt.clf()
plt.imshow(grid_pt_labels)
plt.show()
The entries of orig_bbox
correspond to x_min, x_max, y_min and y_max
. You can decide whether you want to have the drivable area or the non-drivable area by inverting grid_pt_labels
using the tilde (~
). But have in mind that one pixel corresponds to one square meter.
Hi guys,
Im trying to get a BEV rasterized map in a similar way to this:
I have seen several posts in this repo, as well as some map-api functions, but I am not able to run them. For example, after running to code provided by @johnwlambert :
""" pts = get_mesh_grid_as_point_cloud(x_min, x_max, y_min, y_max) pt_labels = avm.get_raster_layer_points_boolean(pts, city_name, layer_name = 'driveable_area')
pdb.set_trace()
"""
I get several errors: IndexError: arrays used as indices must be of integer (or boolean) type
I have tried to convert the pts into integers, etc. I assume this is a quite simple problem and there are several functions of interest in the map-api, such as get_da_contours, build_city_driveable_area_roi_index, etc. but I need urgent help with this.
I only need the white part of the image above, that is, a binary mask with the driveable around a specific point.
I am looking forward to hearing from you.