File: concatenate_points.rst

package info (click to toggle)
pcl 1.15.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 143,128 kB
  • sloc: cpp: 520,234; xml: 28,792; ansic: 8,212; python: 334; lisp: 93; sh: 49; makefile: 30
file content (92 lines) | stat: -rw-r--r-- 2,399 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
.. _concatenate_points:

Concatenate the points or the fields of two Point Clouds
--------------------------------------------------------

In this tutorial we will learn how to concatenating the points of two different
point clouds. The constraint imposed here is that the type and number of fields
in the two datasets have to be equal.

The code
--------

First, create a file, let's say, ``concatenate_points.cpp`` in your favorite
editor, and place the following code inside it:

.. literalinclude:: sources/concatenate_points/concatenate_points.cpp
   :language: cpp
   :linenos:

The explanation
---------------

Now, let's break down the code piece by piece.

In lines:

.. literalinclude:: sources/concatenate_points/concatenate_points.cpp
   :language: cpp
   :lines: 8-29

we define the three Point Clouds: two inputs (cloud_a and cloud_b), one output
(cloud_c), and fill in the data for the two input point clouds.

Then, lines:

.. literalinclude:: sources/concatenate_points/concatenate_points.cpp
   :language: cpp
   :lines: 31-37

display the content of cloud_a and cloud_b to screen.

In line:

.. literalinclude:: sources/concatenate_points/concatenate_points.cpp
   :language: cpp
   :lines: 39-41

we create cloud_c by concatenating the points of cloud_a and cloud_b together.

Finally:

.. literalinclude:: sources/concatenate_points/concatenate_points.cpp
   :language: cpp
   :lines: 43-45

is used to show the content of cloud_c.

Compiling and running the program
---------------------------------

Add the following lines to your CMakeLists.txt file:

.. literalinclude:: sources/concatenate_points/CMakeLists.txt
   :language: cmake
   :linenos:

After you have made the executable, you can run it. Simply do::

  $ ./concatenate_points

You will see something similar to::

  Cloud A: 
      0.352222 -0.151883 -0.106395
      -0.397406 -0.473106 0.292602
      -0.731898 0.667105 0.441304
      -0.734766 0.854581 -0.0361733
      -0.4607 -0.277468 -0.916762
  Cloud B: 
      0.183749 0.968809 0.512055
      -0.998983 -0.463871 0.691785
      0.716053 0.525135 -0.523004
  Cloud C: 
      0.352222 -0.151883 -0.106395 
      -0.397406 -0.473106 0.292602 
      -0.731898 0.667105 0.441304 
      -0.734766 0.854581 -0.0361733 
      -0.4607 -0.277468 -0.916762 
      0.183749 0.968809 0.512055 
      -0.998983 -0.463871 0.691785 
      0.716053 0.525135 -0.523004