Reducing the Size of a Cloud with Grid Decimation¶
The code reduce the size of a cloud by removing points to keep at most one per cell of a regular grid.
C++¶
#include <eVision/Easy3D/EGridDecimator.h>
using namespace eVision;
using namespace eVision::Easy3D;
EPointCloud pc;
pc.Load("");
// Explicitly decimate the point cloud to keep
// one point in every cube of 10*10*10
EGridDecimator decimator(10.f);
EPointCloud pcDecimated;
decimator.Decimate(pc, pcDecimated);
C#¶
using eVision.Easy3D;
EPointCloud pc = new EPointCloud();
pc.Load("");
// Explicitly decimate the point cloud to keep
// one point in every cube of 10*10*10
EGridDecimator decimator = new EGridDecimator(10.0F);
EPointCloud pcDecimated = new EPointCloud();
decimator.Decimate(pc, pcDecimated);
pcDecimated.SavePCD("");
Python¶
from eVision import Easy3D
pc = Easy3D.EPointCloud()
pc.Load("")
# Explicitly decimate the point cloud to keep
# one point in every cube of 10*10*10
decimator = Easy3D.EGridDecimator(10.)
pc_decimated = Easy3D.EPointCloud()
decimator.Decimate(pc, pc_decimated)
pc_decimated.SavePCD("")