MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / main

Function main

tools/unary_classifier_segment.cpp:162–218  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

160
161/* ---[ */
162int
163main (int argc, char** argv)
164{
165 print_info ("Train unary classifier using FPFH. For more information, use: %s -h\n", argv[0]);
166
167 if (argc < 4)
168 {
169 printHelp (argc, argv);
170 return (-1);
171 }
172
173 // Parse the command line arguments for .pcd files
174 std::vector<int> p_file_indices;
175 p_file_indices = parse_file_extension_argument (argc, argv, ".pcd");
176 if (p_file_indices.size () != 2)
177 {
178 print_error ("Need one input PCD file and one output PCD file to continue.\n");
179 return (-1);
180 }
181
182 // Load the input file
183 CloudT::Ptr cloud (new CloudT);
184 if (!loadCloud (argv[p_file_indices[0]], cloud))
185 return (-1);
186
187 // TODO:: make this as an optional argument ??
188 pcl::Indices tmp_indices;
189 pcl::removeNaNFromPointCloud (*cloud, *cloud, tmp_indices);
190
191 // parse optional input arguments from the command line
192 float normal_radius_search = static_cast<float> (default_normal_radius_search);
193 float fpfh_radius_search = static_cast<float> (default_fpfh_radius_search);
194 float feature_threshold = static_cast<float> (default_feature_threshold);
195 std::string dir_name;
196
197 parse_argument (argc, argv, "-d", dir_name);
198 parse_argument (argc, argv, "-threshold", feature_threshold);
199 parse_argument (argc, argv, "-normal-radius-search", normal_radius_search);
200 parse_argument (argc, argv, "-fpfh-radius-search", fpfh_radius_search);
201
202
203 print_info ("trained feature directory: %s \n", dir_name.c_str ());
204
205 // load the trained features
206 std::vector<FeatureT::Ptr> trained_features;
207 if (!loadTrainedFeatures (trained_features, dir_name.c_str ()))
208 return (-1);
209
210 print_info ("feature_threshold: %f \n", feature_threshold);
211 print_info ("normal-radius-search: %f \n", normal_radius_search);
212 print_info ("fpfh-radius-search: %f \n\n", fpfh_radius_search);
213
214 CloudLT::Ptr out (new CloudLT);
215 compute (cloud, trained_features, out, normal_radius_search, fpfh_radius_search, feature_threshold);
216
217 saveCloud (argv[p_file_indices[1]], out);
218}
219

Callers

nothing calls this directly

Calls 7

parse_argumentFunction · 0.85
loadTrainedFeaturesFunction · 0.85
printHelpFunction · 0.70
loadCloudFunction · 0.70
computeFunction · 0.70
saveCloudFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected