cpoint_cloud = np.copy(point_cloud)
rgb_map = np.zeros((3, cnf.BEV_HEIGHT, cnf.BEV_WIDTH), dtype=np.float32)
rgb_map_cnt = np.zeros((cnf.BEV_HEIGHT, cnf.BEV_WIDTH), dtype=np.int)
max_height = float(cnf.boundary['maxZ'] - cnf.boundary['minZ'])
for point in cpoint_cloud:
x = np.floor(point[0] / cnf.DISCRETIZATION_X) + np.int_(cnf.OFFSET_X)
y = np.floor(point[1] / cnf.DISCRETIZATION_Y) + np.int_(cnf.OFFSET_Y)
x = int(x)
y = int(y)
if x >= cnf.BEV_HEIGHT or y >= cnf.BEV_WIDTH:
continue
rgb_map[0, x, y] += point[3] / 255.0
rgb_map[1, x, y] += (point[2] - cnf.boundary['minZ']) / max_height
rgb_map_cnt[x, y] += 1
for point in cpoint_cloud:
x = np.floor(point[0] / cnf.DISCRETIZATION_X) + np.int_(cnf.OFFSET_X)
y = np.floor(point[1] / cnf.DISCRETIZATION_Y) + np.int_(cnf.OFFSET_Y)
x = int(x)
y = int(y)
if x >= cnf.BEV_HEIGHT or y >= cnf.BEV_WIDTH:
continue
if 0 == rgb_map[2, x, y]:
rgb_map[0, x, y] /= rgb_map_cnt[x, y]
rgb_map[1, x, y] /= rgb_map_cnt[x, y]
rgb_map[2, x, y] = np.minimum(1.0, np.log(rgb_map_cnt[x, y]+1) / np.log(cnf.unique_max))