python - 如何在 Open3D 中更改点云中选定点的位置和颜色?
问题描述
我在 Open3D 中创建了一个具有 200 个点的点云(例如 pcd)。现在,我想使用“非阻塞可视化”,例如更改点云中点 0 的位置和颜色。所以,我尝试了这段代码:
for i in range(icp_iteration):
pcd.points[0] = o3d.utility.Vector3dVector(New_Location)
vis.update_geometry(pcd)
vis.poll_events()
vis.update_renderer()
vis.destroy_window()
其中 New_Location 是 (1, 3) numpy 数组。但我得到这个错误:
pcd.points[0] = o3d.utility.Vector3dVector(New_Location)
TypeError: __setitem__(): incompatible function arguments. The following argument types are supported:
1. (self: open3d.cpu.pybind.utility.Vector3dVector, arg0: int, arg1: numpy.ndarray[float64[3, 1]]) -> None
2. (self: open3d.cpu.pybind.utility.Vector3dVector, arg0: slice, arg1: open3d.cpu.pybind.utility.Vector3dVector) -> None
Invoked with: std::vector<Eigen::Vector3d> with 166 elements.
Use numpy.asarray() to access data., 0, std::vector<Eigen::Vector3d> with 1 elements.
Use numpy.asarray() to access data.
Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module.
如果我使用,“颜色”也会发生同样的事情:
pcd.colors[0] = o3d.utility.Vector3dVector(New_Color)
其中“New_Color”是一个 (1, 3) numpy 数组。请注意,我不能使用“翻译”矩阵,因为我只想更改一组点(不是全部)的位置。
如何手动更改点云中一组点的位置、颜色、大小等?
解决方案
推荐阅读
- javascript - 有很多不可变对象还是一些可变对象?
- nginx - Kubernetes Nginx Ingress pod 子路径
- javascript - Chakra UI 的骨架组件在 Flexbox 属性下不起作用
- javascript - 从 Angular 中的函数返回多个值,并在 HTML div 标签中使用这些值。返回值不能分配给 TS 文件中的变量
- python - Discord 机器人未运行和事件循环
- harmonyos - DevEco Studio 中是否有 .xml 的设计选项?
- excel - BI Publisher Excel 模板处理图表中的日期
- node.js - 使用 passport-auth0 进行 MEAN Stack 用户身份验证,在 Anguler 中调用 NodeJs passport-auth0 API
- flutter - Flutter - 在多个提供者之间共享数据
- arrays - 哪种解决方案性能最好,为什么要在复杂列表中查找重复项的数量?