<p>Downsamples a point cloud or <aclass="el"href="classrtabmap_1_1LaserScan.html"title="Represents 2D or 3D laser scan data with support for multiple point data formats.">LaserScan</a> by keeping only every N-th point.
<aclass="el"href="classrtabmap_1_1LaserScan.html">LaserScan</a> RTABMAP_CORE_EXPORT </td><tdclass="memItemRight"valign="bottom"><b>rtabmap::util3d::downsample</b> (const <aclass="el"href="classrtabmap_1_1LaserScan.html">LaserScan</a>&cloud, int step)</td></tr>
<trclass="memdesc:ga83a15e5eaeee8707bfa5563c71154579"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a <aclass="el"href="classrtabmap_1_1LaserScan.html"title="Represents 2D or 3D laser scan data with support for multiple point data formats.">LaserScan</a>. <br/></td></tr>
<trclass="memdesc:ga2f9dd8a7c572ce78b76aec448b17a863"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointXYZ</code>. <br/></td></tr>
<trclass="memdesc:ga7a57facb7148254d43af7577a3716d15"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointXYZRGB</code>. <br/></td></tr>
<trclass="memdesc:gab4b196b83a0634b8e58c145ed54d510d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointXYZI</code>. <br/></td></tr>
<trclass="memdesc:ga83657d48dce8b727088941773f4d8a73"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointNormal</code>. <br/></td></tr>
<trclass="memdesc:ga8c3ca654fb0cc07084fdac8077714b3a"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointXYZRGBNormal</code>. <br/></td></tr>
<trclass="memdesc:ga32d575439b2f5082c3946bc964c14b75"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Downsamples a point cloud of type <code>pcl::PointXYZINormal</code>. <br/></td></tr>
<p>Downsamples a point cloud or <aclass="el"href="classrtabmap_1_1LaserScan.html"title="Represents 2D or 3D laser scan data with support for multiple point data formats.">LaserScan</a> by keeping only every N-th point. </p>
<p>This function downsamples a point cloud based on a specified step size. The method adapts based on whether the cloud is organized (2D) or unorganized (1D), and whether it's structured like a depth image or LiDAR scan.</p>
<ul>
<li>For <b>unorganized point clouds</b>: Every <code>step</code>-th point is retained linearly.</li>
<li>For <b>organized point clouds</b> with LiDAR-like layout (e.g., 2048x64): Downsampling is performed along the "long" dimension, preserving the ring structure.</li>
<li>For <b>depth-image-like organized clouds</b> (e.g., 640x480): Downsampling is performed in both row and column directions, similar to image decimation. Step size must divide both width and height exactly.</li>
</ul>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">cloud</td><td>The input point cloud to downsample. </td></tr>
<tr><tdclass="paramname">step</td><td>The decimation step. Must be greater than 0. </td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>A new point cloud containing only the sampled points.</dd></dl>
<dlclass="section note"><dt>Note</dt><dd>If <code>step <= 1</code> or the cloud has fewer points than <code>step</code>, the function returns a copy of the input cloud. </dd></dl>
<dlclass="exception"><dt>Exceptions</dt><dd>
<tableclass="exception">
<tr><tdclass="paramname">Assertion</td><td>failure if <code>step <= 0</code> or, in the case of depth-image-style clouds, if the width and height are not divisible by <code>step</code>. </td></tr>
</table>
</dd>
</dl>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<ul>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.8 </li>