You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to merge 2 tensor point clouds but am getting at index error. One point cloud is empty, while another has points. I am trying to do this as I am dynamically merging point clouds from scratch
I have tried both + notation and append function (which I assume performs the same operation, but there is no description in the docs) and both methods fail.
The legacy format accounted for this and allowed you to merge empty point clouds.
Steps to reproduce the bug
importopen3daso3dimportopen3d.coreaso3c# legacy point cloud merges successfully with empty point cloudpcd_1=o3d.geometry.PointCloud()
pcd_2=o3d.geometry.PointCloud()
pcd_2.points=o3d.utility.Vector3dVector([[0, 0, 0], [1, 1, 1]])
pcd_1+=pcd_2# tensor point cloud fails to merge with emptypcd_3=o3d.t.geometry.PointCloud()
pcd_4=o3d.t.geometry.PointCloud(o3c.Tensor([[0, 0, 0], [1, 1, 1]], o3c.float32))
pcd_3+=pcd_4
Error message
IndexError: invalid unordered_map<K, T> key
Expected behavior
Empty tensor point clouds successfully merges with other point clouds without fail
Open3D, Python and System information
- Operating system: Windows 10 64-bit
- Python version: Python 3.11.9
- Open3D version: 0.18.0
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
- Compiler version (if built from source): N/A
Additional information
No response
The text was updated successfully, but these errors were encountered:
In general, the error occurs when you call a method (on an empty tensor PointCloud) containing a call to GetPointPositions() (which are many).
The reason is that a tensor point cloud created with the constructor PointCloud() or PointCloud(device) does not set the positions attribute in its TensorMap, and the internal call to GetPointPositions() will raise a map index error.
The problem might be solved by setting the positions attribute to an empty tensor in the constructor of the empty PointCloud: SetPointPositions(core::Tensor::Empty({0, 3}, core::Float32, device_)). However, this would cause errors if the user is using a different dtype. For example in this merging issue, if pcd_4 is created with the o3c.float64 dtype, an error will occur because the empty point cloud pcd_3 will have o3c.float32 dtype, and vice versa.
@ssheorey@benjaminum do you have any ideas? I could open a PR to fix this specific merging issue (if positions is not set, set it as an empty tensor with the same dtype as the other point cloud), but the other PointCloud methods require a deeper fix. Or at least, I can add a descriptive log error in GetPointPositions() if the positions attribute is not set.
Checklist
main
branch).Describe the issue
I am trying to merge 2 tensor point clouds but am getting at index error. One point cloud is empty, while another has points. I am trying to do this as I am dynamically merging point clouds from scratch
I have tried both
+
notation andappend
function (which I assume performs the same operation, but there is no description in the docs) and both methods fail.The legacy format accounted for this and allowed you to merge empty point clouds.
Steps to reproduce the bug
Error message
IndexError: invalid unordered_map<K, T> key
Expected behavior
Empty tensor point clouds successfully merges with other point clouds without fail
Open3D, Python and System information
Additional information
No response
The text was updated successfully, but these errors were encountered: