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

Function main

tools/transform_point_cloud.cpp:253–359  ·  view source on GitHub ↗

---[ */

Source from the content-addressed store, hash-verified

251
252/* ---[ */
253int
254main (int argc, char** argv)
255{
256 print_info ("Transform a cloud. For more information, use: %s -h\n", argv[0]);
257
258 bool help = false;
259 parse_argument (argc, argv, "-h", help);
260 if (argc < 3 || help)
261 {
262 printHelp (argc, argv);
263 return (-1);
264 }
265
266 // Parse the command line arguments for .pcd files
267 std::vector<int> p_file_indices;
268 p_file_indices = parse_file_extension_argument (argc, argv, ".pcd");
269 if (p_file_indices.size () != 2)
270 {
271 print_error ("Need one input PCD file and one output PCD file to continue.\n");
272 return (-1);
273 }
274
275 // Initialize the transformation matrix
276 Eigen::Matrix4f tform;
277 tform.setIdentity ();
278
279 // Command line parsing
280 float dx, dy, dz;
281 std::vector<float> values;
282
283 if (parse_3x_arguments (argc, argv, "-trans", dx, dy, dz) > -1)
284 {
285 tform (0, 3) = dx;
286 tform (1, 3) = dy;
287 tform (2, 3) = dz;
288 }
289
290 if (parse_x_arguments (argc, argv, "-quat", values) > -1)
291 {
292 if (values.size () == 4)
293 {
294 const float& x = values[0];
295 const float& y = values[1];
296 const float& z = values[2];
297 const float& w = values[3];
298 tform.topLeftCorner<3, 3> () = Eigen::Matrix3f (Eigen::Quaternionf (w, x, y, z));
299 }
300 else
301 {
302 print_error ("Wrong number of values given (%lu): ", values.size ());
303 print_error ("The quaternion specified with -quat must contain 4 elements (w,x,y,z).\n");
304 }
305 }
306
307 if (parse_x_arguments (argc, argv, "-axisangle", values) > -1)
308 {
309 if (values.size () == 4)
310 {

Callers

nothing calls this directly

Calls 8

parse_argumentFunction · 0.85
AngleAxisfFunction · 0.85
scaleInPlaceFunction · 0.85
printHelpFunction · 0.70
loadCloudFunction · 0.70
computeFunction · 0.70
saveCloudFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected