---[ */
| 153 | |
| 154 | /* ---[ */ |
| 155 | int |
| 156 | main (int argc, char** argv) |
| 157 | { |
| 158 | print_info ("Moving Least Squares smoothing of a point cloud. For more information, use: %s -h\n", argv[0]); |
| 159 | |
| 160 | if (argc < 3) |
| 161 | { |
| 162 | printHelp (argc, argv); |
| 163 | return (-1); |
| 164 | } |
| 165 | |
| 166 | // Parse the command line arguments for .pcd files |
| 167 | std::vector<int> p_file_indices; |
| 168 | p_file_indices = parse_file_extension_argument (argc, argv, ".pcd"); |
| 169 | if (p_file_indices.size () != 2) |
| 170 | { |
| 171 | print_error ("Need one input PCD file and one output PCD file to continue.\n"); |
| 172 | return (-1); |
| 173 | } |
| 174 | |
| 175 | // Command line parsing |
| 176 | double search_radius = default_search_radius; |
| 177 | double sqr_gauss_param = default_sqr_gauss_param; |
| 178 | bool sqr_gauss_param_set = true; |
| 179 | int polynomial_order = default_polynomial_order; |
| 180 | |
| 181 | parse_argument (argc, argv, "-radius", search_radius); |
| 182 | parse_argument (argc, argv, "-polynomial_order", polynomial_order); |
| 183 | if (parse_argument (argc, argv, "-sqr_gauss_param", sqr_gauss_param) == -1) |
| 184 | sqr_gauss_param_set = false; |
| 185 | |
| 186 | // Load the first file |
| 187 | pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2); |
| 188 | if (!loadCloud (argv[p_file_indices[0]], *cloud)) |
| 189 | return (-1); |
| 190 | |
| 191 | // Do the smoothing |
| 192 | pcl::PCLPointCloud2 output; |
| 193 | compute (cloud, output, search_radius, sqr_gauss_param_set, sqr_gauss_param, polynomial_order); |
| 194 | |
| 195 | // Save into the second file |
| 196 | saveCloud (argv[p_file_indices[1]], output); |
| 197 | } |