285 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Getting Started / Basic Structures &mdash; Point Cloud Library 1.12.0 documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Point Cloud Library
</a>
<div class="version">
1.12.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">Getting Started / Basic Structures</a></li>
<li><a class="reference internal" href="#compiling-your-first-code-example">Compiling your first code example</a></li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Point Cloud Library</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Getting Started / Basic Structures</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="getting-started-basic-structures">
<span id="basic-structures"></span><h1>Getting Started / Basic Structures</h1>
<p>The basic data type in PCL 1.x is a <span>PointCloud</span>. A
PointCloud is a C++ class which contains the following data fields:</p>
<blockquote>
<div><ul>
<li><p class="first"><span>width</span> (int)</p>
<p>Specifies the width of the point cloud dataset in the number of points. <em>width</em> has two meanings:</p>
<blockquote>
<div><ul class="simple">
<li>it can specify the total number of points in the cloud (equal with the number of elements in <strong>points</strong> see below) for unorganized datasets;</li>
<li>it can specify the width (total number of points in a row) of an organized point cloud dataset.</li>
</ul>
</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An <strong>organized point cloud</strong> dataset is the name given to point clouds
that resemble an organized image (or matrix) like structure, where the
data is split into rows and columns. Examples of such point clouds
include data coming from stereo cameras or Time Of Flight cameras. The
advantages of an organized dataset is that by knowing the relationship
between adjacent points (e.g. pixels), nearest neighbor operations are
much more efficient, thus speeding up the computation and lowering the
costs of certain algorithms in PCL.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An <strong>projectable point cloud</strong> dataset is the name given to point clouds
that have a correlation according to a pinhole camera model between the (u,v) index
of a point in the organized point cloud and the actual 3D values. This correlation can be
expressed in its easiest form as: u = f*x/z and v = f*y/z</p>
</div>
<p>Examples:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cloud</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="mi">640</span><span class="p">;</span> <span class="o">//</span> <span class="n">there</span> <span class="n">are</span> <span class="mi">640</span> <span class="n">points</span> <span class="n">per</span> <span class="n">line</span>
</pre></div>
</div>
</li>
<li><p class="first"><span>height</span> (int)</p>
<p>Specifies the height of the point cloud dataset in the number of points. <em>height</em> has two meanings:</p>
<blockquote>
<div><ul class="simple">
<li>it can specify the height (total number of rows) of an organized point cloud dataset;</li>
<li>it is set to <strong>1</strong> for unorganized datasets (<em>thus used to check whether a dataset is organized or not</em>).</li>
</ul>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cloud</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="mi">640</span><span class="p">;</span> <span class="o">//</span> <span class="n">Image</span><span class="o">-</span><span class="n">like</span> <span class="n">organized</span> <span class="n">structure</span><span class="p">,</span> <span class="k">with</span> <span class="mi">480</span> <span class="n">rows</span> <span class="ow">and</span> <span class="mi">640</span> <span class="n">columns</span><span class="p">,</span>
<span class="n">cloud</span><span class="o">.</span><span class="n">height</span> <span class="o">=</span> <span class="mi">480</span><span class="p">;</span> <span class="o">//</span> <span class="n">thus</span> <span class="mi">640</span><span class="o">*</span><span class="mi">480</span><span class="o">=</span><span class="mi">307200</span> <span class="n">points</span> <span class="n">total</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">dataset</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cloud</span><span class="o">.</span><span class="n">width</span> <span class="o">=</span> <span class="mi">307200</span><span class="p">;</span>
<span class="n">cloud</span><span class="o">.</span><span class="n">height</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="o">//</span> <span class="n">unorganized</span> <span class="n">point</span> <span class="n">cloud</span> <span class="n">dataset</span> <span class="k">with</span> <span class="mi">307200</span> <span class="n">points</span>
</pre></div>
</div>
</div></blockquote>
</li>
<li><p class="first"><span>points</span> (std::vector&lt;PointT&gt;)</p>
<p>Contains the data array where all the points of type <strong>PointT</strong> are stored. For example, for a cloud containing XYZ data, <strong>points</strong> contains a vector of <em>pcl::PointXYZ</em> elements:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pcl</span><span class="p">::</span><span class="n">PointCloud</span><span class="o">&lt;</span><span class="n">pcl</span><span class="p">::</span><span class="n">PointXYZ</span><span class="o">&gt;</span> <span class="n">cloud</span><span class="p">;</span>
<span class="n">std</span><span class="p">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">pcl</span><span class="p">::</span><span class="n">PointXYZ</span><span class="o">&gt;</span> <span class="n">data</span> <span class="o">=</span> <span class="n">cloud</span><span class="o">.</span><span class="n">points</span><span class="p">;</span>
</pre></div>
</div>
</li>
<li><p class="first"><span>is_dense</span> (bool)</p>
<p>Specifies if all the data in <strong>points</strong> is finite (true), or whether the XYZ values of certain points might contain Inf/NaN values (false).</p>
</li>
<li><p class="first"><span>sensor_origin_</span> (Eigen::Vector4f)</p>
<p>Specifies the sensor acquisition pose (origin/translation). This member is usually optional, and not used by the majority of the algorithms in PCL.</p>
</li>
<li><p class="first"><span>sensor_orientation_</span> (Eigen::Quaternionf)</p>
<p>Specifies the sensor acquisition pose (orientation). This member is usually optional, and not used by the majority of the algorithms in PCL.</p>
</li>
</ul>
</div></blockquote>
<p>To simplify development, the <span>PointCloud</span> class contains
a number of helper member functions. For example, users dont have to check if
<strong>height</strong> equals 1 or not in their code in order to see if a dataset is
organized or not, but instead use <span>PointCloud</span>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>if (!cloud.isOrganized ())
...
</pre></div>
</div>
<p>The <strong>PointT</strong> type is the primary point data type and describes what each
individual element of <span>points</span> holds. PCL comes
with a large variety of different point types, most explained in the
<a class="reference internal" href="adding_custom_ptype.html#adding-custom-ptype"><span class="std std-ref">Adding your own custom PointT type</span></a> tutorial.</p>
</div>
<div class="section" id="compiling-your-first-code-example">
<h1>Compiling your first code example</h1>
<p>Until we find the right minimal code example, please take a look at the
<a class="reference internal" href="using_pcl_pcl_config.html#using-pcl-pcl-config"><span class="std std-ref">Using PCL in your own project</span></a> and <a class="reference internal" href="writing_new_classes.html#writing-new-classes"><span class="std std-ref">Writing a new PCL class</span></a> tutorials to see how
to compile and write code for or using PCL.</p>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>