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

Function main

tools/grid_min.cpp:144–220  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

142
143/* ---[ */
144int
145main (int argc, char** argv)
146{
147 print_info ("Filter a point cloud using the pcl::GridMinimum filter. For more information, use: %s -h\n", argv[0]);
148
149 if (argc < 3)
150 {
151 printHelp (argc, argv);
152 return (-1);
153 }
154
155 bool batch_mode = false;
156
157 // Command line parsing
158 float resolution = default_resolution;
159 parse_argument (argc, argv, "-resolution", resolution);
160 std::string input_dir, output_dir;
161 if (parse_argument (argc, argv, "-input_dir", input_dir) != -1)
162 {
163 PCL_INFO ("Input directory given as %s. Batch process mode on.\n", input_dir.c_str ());
164 if (parse_argument (argc, argv, "-output_dir", output_dir) == -1)
165 {
166 PCL_ERROR ("Need an output directory! Please use -output_dir to continue.\n");
167 return (-1);
168 }
169
170 // Both input dir and output dir given, switch into batch processing mode
171 batch_mode = true;
172 }
173
174 if (!batch_mode)
175 {
176 // Parse the command line arguments for .pcd files
177 std::vector<int> p_file_indices;
178 p_file_indices = parse_file_extension_argument (argc, argv, ".pcd");
179 if (p_file_indices.size () != 2)
180 {
181 print_error ("Need one input PCD file and one output PCD file to continue.\n");
182 return (-1);
183 }
184
185 // Load the first file
186 Cloud::Ptr cloud (new Cloud);
187 if (!loadCloud (argv[p_file_indices[0]], *cloud))
188 return (-1);
189
190 // Perform the feature estimation
191 Cloud output;
192 compute (cloud, output, resolution);
193
194 // Save into the second file
195 saveCloud (argv[p_file_indices[1]], output);
196 }
197 else
198 {
199 if (!input_dir.empty() && pcl_fs::exists (input_dir))
200 {
201 std::vector<std::string> pcd_files;

Callers

nothing calls this directly

Calls 9

parse_argumentFunction · 0.85
printHelpFunction · 0.70
loadCloudFunction · 0.70
computeFunction · 0.70
saveCloudFunction · 0.70
batchProcessFunction · 0.70
sizeMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected