【发布时间】:2021-05-14 09:18:16
【问题描述】:
我有一个 xyz 点云 (pcd) 作为大小 (N, 3) 的矩阵和一个图像 (img) 作为大小 (H, W)。我想要图像投影的点,所以我有以下面具的重聚:
true_where_x_on_img = (0
true_where_y_on_img = (0
true_where_point_on_img = true_where_x_on_img & true_where_y_on_img
此掩码的大小为 N 并按预期工作(使用 pcd[true_where_point_on_img])。现在我使用另一个掩码过滤这些值,该掩码告诉我图像中的像素是否为背景:
true_where_not_background = mask[pcd[:, 1], pcd[:, 0]] != 0
true_where_not_background 的大小为 M,因为掩码是 H x W。 最后,我想将这些结果投影到更大矩阵的第 4 列,aug_pcd,大小为 N x 4。这个矩阵用零初始化,pcd 被复制到它的前 3 列。我现在想将蒙版图像 (img[true_where_not_background]) 放入第 4 列。类似 aug_pcd[true_where_not_background, 3:] = img[true_where_not_background]。问题是 true_where_not_background 的大小为 M,而 aug_pcd 的行大小为 N 并且已经是完整的切片。切片切片会生成一个我无法为其赋值的副本。如何混合 true_where_point_on_img 和 true_where_not_background 以便我可以拥有 N 大小的蒙版?
【问题讨论】:
-
请使用正确的代码格式,并请提供minimal reproducible example。