Can not downsample a point cloud in open3D

Question:

I am new to open3D pythong binding.

I am trying to downsample a point clout and I have this code:

import open3d as o3d
input_file='mypoints.ply'
pcd = o3d.io.read_point_cloud(input_file)
voxel_down_pcd = o3d.geometry.voxel_down_sample(pcd, voxel_size=0.02)
o3d.visualization.draw_geometries([voxel_down_pcd])

but when I run the code I am getting this error:

module 'open3d.cpu.pybind.geometry' has no attribute 'voxel_down_sample'

I got the sample from Open3D website tutorial

What is the problem and how I can fix it?

Asked By: mans

||

Answers:

You need to call the voxel_down_sample() on the pcd object. For ex, in your case, it will be like this:

import open3d as o3d
input_file='mypoints.ply'
pcd = o3d.io.read_point_cloud(input_file)
voxel_down_pcd = pcd.voxel_down_sample(pcd, voxel_size=0.02)
Answered By: planet_pluto

try this

downpcd = pcd.voxel_down_sample(voxel_size=0.02)

Answered By: Anass Maourid
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.