14 PrintCloudViewerVersion();
18 utility::LogInfo(
" > ConvertPointCloud source_directory target_directory [options]");
19 utility::LogInfo(
" Read point cloud from source file and convert it to target file.");
30 utility::LogInfo(
" --filter_mahalanobis d : Filter out points with Mahalanobis distance > d.");
31 utility::LogInfo(
" --uniform_sample_every K : Downsample the point cloud uniformly. Keep only");
33 utility::LogInfo(
" --voxel_sample voxel_size : Downsample the point cloud with a voxel.");
34 utility::LogInfo(
" --estimate_normals radius : Estimate normals using a search neighborhood of");
39 utility::LogInfo(
" --estimate_normals_knn k : Estimate normals using a search with k nearest");
44 utility::LogInfo(
" --orient_normals [x,y,z] : Orient the normals w.r.t the direction [x,y,z].");
45 utility::LogInfo(
" --camera_location [x,y,z] : Orient the normals w.r.t camera location [x,y,z].");
51 const std::string &file_in,
52 const std::string &file_out) {
61 bool processed =
false;
66 {
"--clip_x_min",
"--clip_x_max",
"--clip_y_min",
"--clip_y_max",
67 "--clip_z_min",
"--clip_z_max"})) {
68 Eigen::Vector3d min_bound, max_bound;
70 argc, argv,
"--clip_x_min",
71 std::numeric_limits<double>::lowest());
73 argc, argv,
"--clip_y_min",
74 std::numeric_limits<double>::lowest());
76 argc, argv,
"--clip_z_min",
77 std::numeric_limits<double>::lowest());
90 argc, argv,
"--filter_mahalanobis", 0.0);
91 if (mahalanobis_threshold > 0.0) {
93 std::vector<size_t> indices;
95 if (mahalanobis[i] < mahalanobis_threshold) {
101 "Based on Mahalanobis distance, {:d} points were filtered.",
108 "--uniform_sample_every", 0);
118 argc, argv,
"--voxel_sample", 0.0);
119 if (voxel_size > 0.0) {
128 argc, argv,
"--estimate_normals", 0.0);
147 argc, argv,
"--orient_normals");
150 direction(1), direction(2));
151 Eigen::Vector3d dir(direction);
156 argc, argv,
"--camera_location");
159 camera_loc(0), camera_loc(1), camera_loc(2));
160 Eigen::Vector3d loc(camera_loc);
168 "Processed point cloud from {:d} points to {:d} points.",
169 (
int)point_num_in, (
int)point_num_out);
174 int main(
int argc,
char **argv) {
188 convert(argc, argv, argv[1], argv[2]);
191 std::vector<std::string> filenames;
193 for (
const auto &fn : filenames) {
int main(int argc, char **argv)
void convert(int argc, char **argv, const std::string &file_in, const std::string &file_out)
ccPointCloud * pointcloud_ptr
std::shared_ptr< ccPointCloud > Crop(const ccBBox &bbox) const
Function to crop ccPointCloud into output ccPointCloud.
bool EstimateNormals(const cloudViewer::geometry::KDTreeSearchParam &search_param=cloudViewer::geometry::KDTreeSearchParamKNN(), bool fast_normal_computation=true)
Function to compute the normals of a point cloud.
bool OrientNormalsTowardsCameraLocation(const Eigen::Vector3d &camera_location=Eigen::Vector3d::Zero())
Function to orient the normals of a point cloud.
std::vector< double > ComputeMahalanobisDistance() const
Function to compute the Mahalanobis distance for points in an input point cloud.
bool hasNormals() const override
Returns whether normals are enabled or not.
bool OrientNormalsToAlignWithDirection(const Eigen::Vector3d &orientation_reference=Eigen::Vector3d(0.0, 0.0, 1.0))
Function to orient the normals of a point cloud.
std::shared_ptr< ccPointCloud > VoxelDownSample(double voxel_size)
Function to downsample input ccPointCloud into output ccPointCloud with a voxel.
std::shared_ptr< ccPointCloud > SelectByIndex(const std::vector< size_t > &indices, bool invert=false) const
Function to select points from input ccPointCloud into output ccPointCloud.
std::shared_ptr< ccPointCloud > UniformDownSample(size_t every_k_points) const
Function to downsample input ccPointCloud into output ccPointCloud uniformly.
unsigned size() const override
KDTree search parameters for pure KNN search.
KDTree search parameters for pure radius search.
bool WritePointCloud(const std::string &filename, const ccPointCloud &pointcloud, const WritePointCloudOption ¶ms)
std::shared_ptr< ccPointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
bool ListFilesInDirectory(const std::string &directory, std::vector< std::string > &filenames)
bool MakeDirectoryHierarchy(const std::string &directory)
bool DirectoryExists(const std::string &directory)
std::string GetRegularizedDirectoryName(const std::string &directory)
bool FileExists(const std::string &filename)
std::string GetFileNameWithoutDirectory(const std::string &filename)
int GetProgramOptionAsInt(int argc, char **argv, const std::string &option, const int default_value=0)
void SetVerbosityLevel(VerbosityLevel level)
bool ProgramOptionExistsAny(int argc, char **argv, const std::vector< std::string > &options)
bool ProgramOptionExists(int argc, char **argv, const std::string &option)
Eigen::VectorXd GetProgramOptionAsEigenVectorXd(int argc, char **argv, const std::string &option, const Eigen::VectorXd default_value=Eigen::VectorXd::Zero(0))
double GetProgramOptionAsDouble(int argc, char **argv, const std::string &option, const double default_value=0.0)
Generic file read and write utility for python interface.