传递参数有两种方法:一、使用VS中的属性页配置;二、使用cmd命令行执行程序并设置传递的参数
一、使用vs中的属性页配置
项目--> 右键“属性”--> 调试--> 命令参数,中输入需要的参数信息,每个参数之间以空格隔开,如图。
需要注意的一点是配置选项中一定要是"Debug"。
传递的参数总共是5个,其中argv[0]默认为当前执行的程序路径,argv[1] , argv[2] , argv[3],argv[4]这四个参数便是我们在上面的“命令参数”中填入的参数,这里分别是待配准的两片点云路径和 输出配准之后的点云的路径,以及选定的icp方法为point-to-point icp。
二、使用cmd命令执行程序并传递参数
如下是输入参数的提示信息:
Help :
==============================================================================================
Short_name Long_name Description Default_value
==============================================================================================
-h --help show option help false
-d --demo demo mode (uses integrated media) false
-i1 --input_1 Path to first input obj file (REQUIRED)
-i2 --input_2 Path to second input obj file (REQUIRED)
-o --output Path to the output directory (REQUIRED)
-n --name Name of the output file output
-k --k_normals knn parameter for normals computation 10
-n1 --n_iterations_1 Nb of iterations for the algorithm 25
-n2 --n_iterations_2 Nb of iterations for the algorithm's step 2 2
-mu --mu Parameter for step 2.1 10
-ns --n_iterations_shrink Number of iterations for shrink step (2.1) 3
-p --p_norm Use of norm L_p 0.5
-po --point_to_point Use point to point variant false
-pl --point_to_plane Use point to plane variant false
-v --verbose Verbosity trigger false
==============================================================================================
可以看到-i1 , -i2 , -o这3个参数是必须要设置的,同时还要通过参数 -p0, -p1, 选择是使用point-to-point icp or point-to-plane icp 。
输入的命令如下:
E:\PROJECT\C++Projects\icpSparse\Debug>icpSparse.exe --input_1 E:\media\bunny_side1.obj --input_2 E:\media\bunny_side2.obj --output E:\media\output --point_to_point