Я работаю над классификацией объектов (и задачей по обнаружению). Мне нужно использовать как лидар, так и данные камеры. Мне удалось получить координаты трехмерных точек на плоскости изображения, но у меня возникли некоторые трудности с вычислением значений пикселей для нового лидарного изображения. Я слежу за идеей статьи:
![Pixel](https://image.noelshack.com/fichiers/2019/23/1/1559578787-stack4.png)
Вот мой код для генерации лидарного изображения:
"""
1. Color Point Cloud from RGB Image
2. Project Point Cloud into RGB Image for depth
3. Also apply to Gray Image
"""
def lidar_camera_fusion2(point_cloud, image, T_velo_cam, P_velo_image):
image_size = image.shape
point_cloud_size = point_cloud.shape[0]
X_coordinates = point_cloud[:,0]
Y_coordinates = point_cloud[:,1]
Z_coordinates = point_cloud[:,2]
Ref_values = point_cloud[:,3]
print("Creating Lidar Image...")
image_lidar = np.zeros(image_size, dtype=np.uint8)
xyz = point_cloud.copy()
xyz[:,3] = 1.0 # Assign all reflectance to 1
# project into image
velo_img = np.dot(P_velo_image, xyz.T).T #P_velo_image = P_rect[i] *R_rect_00*T_cam_velo,
# normalize homogeneous coordinates
velo_img = np.true_divide(velo_img[:,:2], velo_img[:,[-1]]) #Divide the first two columns by the third column element for each row
velo_img = np.round(velo_img).astype(np.uint16) #Arrondit à l'entier supérieur car les index des pixels doivent être des entiers
#Compute DHI channels
# compute depth
depth = 255 * (1 -np.minimum(X_coordinates/max(X_coordinates), 1))
depth = np.round(depth).astype(np.uint16)
#compute height
height = 255 * (1 -np.minimum(Z_coordinates/max(Z_coordinates), 1))
height = np.round(height).astype(np.uint16)
#compute intensity
intensity = 255 * (1 -np.minimum(Ref_values/max(Ref_values), 1))
intensity = np.round(intensity).astype(np.uint16)
for pt in range(0, velo_img.shape[0]):
row_idx = velo_img[pt][1]
col_idx = velo_img[pt][0]
if (row_idx >= 0 and row_idx < image_size[0]) and (col_idx >= 0 and col_idx < image_size[1]):
# assign point cloud to image pixel
image_lidar[row_idx][col_idx]=[height[pt],depth[pt],intensity[pt]]
return image_lidar
И вот мой результат:
![result](https://image.noelshack.com/fichiers/2019/23/1/1559578797-stack5.png)
Я не думаю, что изображение предлагает достаточно информации для использования в CNN.
Используется набор данных Китти. Вот изображение камеры, связанное с облаком точек:
![img](https://image.noelshack.com/fichiers/2019/23/1/1559579316-stack6.png)
Я пробовал другой метод, но я не думаю, что он тоже будет работать для CNN.
![2dntry](https://image.noelshack.com/fichiers/2019/23/1/1559579487-stack7.png)
Что не так в моем коде? Какими должны быть значения пикселей для кодирования глубины, высоты и отражательной способности или обоснования только глубины и отражательной способности. Я хотел бы использовать глубинные изображения (генерируемые из облака точек) и «отражательные изображения», чтобы использовать их с изображениями с камер для классификации объектов с помощью мультимодального глубокого обучения.
Заранее спасибо