19 transformation(0, 0), transformation(0, 1),
20 transformation(0, 2), transformation(0, 3));
22 transformation(1, 0), transformation(1, 1),
23 transformation(1, 2), transformation(1, 3));
25 transformation(2, 0), transformation(2, 1),
26 transformation(2, 2), transformation(2, 3));
28 transformation(3, 0), transformation(3, 1),
29 transformation(3, 2), transformation(3, 3));
36 utility::LogInfo(
" > ManuallyAlignPointCloud source_file target_file [options]");
37 utility::LogInfo(
" Manually align point clouds in source_file and target_file.");
43 utility::LogInfo(
" --max_corres_distance d : Set max correspondence distance.");
44 utility::LogInfo(
" --without_scaling : Disable scaling in transformations.");
45 utility::LogInfo(
" --without_dialog : Disable dialogs. Default files will be used.");
46 utility::LogInfo(
" --without_gui_icp file : The program runs as a console command. No window");
50 utility::LogInfo(
" --without_gui_eval file : The program runs as a console command. No window");
57 int main(
int argc,
char **argv) {
71 argc, argv,
"--max_corres_distance", -1.0);
76 std::string default_polygon_filename =
79 argc, argv,
"--without_gui_icp",
"");
81 argc, argv,
"--without_gui_eval",
"");
82 std::string default_directory =
87 if (source_ptr ==
nullptr || target_ptr ==
nullptr ||
88 source_ptr->IsEmpty() || target_ptr->IsEmpty()) {
93 if (!alignment_filename.empty()) {
101 auto polygon_volume =
102 std::make_shared<visualization::SelectionPolygonVolume>();
106 source_ptr = polygon_volume->CropPointCloud(*source_ptr);
108 if (voxel_size > 0.0) {
111 source_ptr = source_ptr->VoxelDownSample(voxel_size);
113 if (max_corres_distance > 0.0) {
115 max_corres_distance);
117 *source_ptr, *target_ptr, max_corres_distance,
118 Eigen::Matrix4d::Identity(),
119 pipelines::registration::
120 TransformationEstimationPointToPoint(
true),
124 "Registration finished with fitness {:.4f} and RMSE "
127 if (
result.fitness_ > 0.0) {
131 source_ptr->Transform(
result.transformation_);
138 if (!eval_filename.empty()) {
144 auto polygon_volume =
145 std::make_shared<visualization::SelectionPolygonVolume>();
149 source_ptr = polygon_volume->CropPointCloud(*source_ptr);
151 if (voxel_size > 0.0) {
154 source_ptr = source_ptr->VoxelDownSample(voxel_size);
156 std::string source_filename =
160 std::string target_filename =
164 std::string source_binname =
168 std::string target_binname =
175 auto source_dis = source_ptr->ComputePointCloudDistance(*target_ptr);
177 fwrite(source_dis.data(),
sizeof(
double), source_dis.size(), f);
184 auto target_dis = target_ptr->ComputePointCloudDistance(*source_ptr);
186 fwrite(target_dis.data(),
sizeof(
double), target_dis.size(), f);
197 max_corres_distance, with_scaling,
198 with_dialog, default_polygon_filename,
203 if (source_ptr->points_.size() > 5000000) {
209 if (target_ptr->points_.size() > 5000000) {
void PrintTransformation(const Eigen::Matrix4d &transformation)
int main(int argc, char **argv)
double max_correspondence_distance_
Eigen::Matrix4d_u transformation_
bool AddSourceAndTarget(std::shared_ptr< ccPointCloud > source, std::shared_ptr< ccPointCloud > target)
Class that defines the convergence criteria of ICP.
double point_size_
Point size for PointCloud.
Visualizer with editing capabilities.
void BuildUtilities() override
bool AddGeometry(std::shared_ptr< const ccHObject > geometry_ptr, bool reset_bounding_box=true) override
Function to add geometry to the scene and create corresponding shaders.
RenderOption & GetRenderOption()
Function to retrieve the associated RenderOption.
void DestroyVisualizerWindow()
Function to destroy a window.
bool CreateVisualizerWindow(const std::string &window_name="CloudViewer", const int width=640, const int height=480, const int left=50, const int top=50, const bool visible=true)
Function to create a window and initialize GLFW.
virtual void BuildUtilities()
bool WriteIJsonConvertible(const std::string &filename, const cloudViewer::utility::IJsonConvertible &object)
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 ReadIJsonConvertible(const std::string &filename, cloudViewer::utility::IJsonConvertible &object)
RegistrationResult RegistrationICP(const ccPointCloud &source, const ccPointCloud &target, double max_correspondence_distance, const Eigen::Matrix4d &init, const TransformationEstimation &estimation, const ICPConvergenceCriteria &criteria)
Functions for ICP registration.
std::string GetFileParentDirectory(const std::string &filename)
std::string GetFileNameWithoutExtension(const std::string &filename)
FILE * FOpen(const std::string &filename, const std::string &mode)
int GetProgramOptionAsInt(int argc, char **argv, const std::string &option, const int default_value=0)
void SetVerbosityLevel(VerbosityLevel level)
bool ProgramOptionExists(int argc, char **argv, const std::string &option)
std::string GetProgramOptionAsString(int argc, char **argv, const std::string &option, const std::string &default_value="")
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.