Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
octree
octree_pointcloud_changedetector.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2011, Willow Garage, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of Willow Garage, Inc. nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
* $Id$
37
*/
38
39
#pragma once
40
41
#include <pcl/octree/octree2buf_base.h>
42
#include <pcl/octree/octree_pointcloud.h>
43
#include <
pcl/memory.h
>
44
45
namespace
pcl
{
46
namespace
octree
{
47
48
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
49
/** \brief @b Octree pointcloud change detector class
50
* \note This pointcloud octree class generate an octrees from a point cloud
51
* (zero-copy). It allows to detect new leaf nodes and serialize their point indices
52
* \note The octree pointcloud is initialized with its voxel resolution. Its bounding
53
* box is automatically adjusted or can be predefined.
54
* \tparam PointT type of point used in pointcloud
55
* \ingroup octree
56
* \author Julius Kammerl (julius@kammerl.de)
57
*/
58
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
59
template
<
typename
PointT,
60
typename
LeafContainerT =
OctreeContainerPointIndices
,
61
typename
BranchContainerT =
OctreeContainerEmpty
>
62
63
class
OctreePointCloudChangeDetector
64
:
public
OctreePointCloud
<PointT,
65
LeafContainerT,
66
BranchContainerT,
67
Octree2BufBase<LeafContainerT, BranchContainerT>>
68
69
{
70
71
public
:
72
using
Ptr
= shared_ptr<
73
OctreePointCloudChangeDetector<PointT, LeafContainerT, BranchContainerT>
>;
74
using
ConstPtr
= shared_ptr<
75
const
OctreePointCloudChangeDetector<PointT, LeafContainerT, BranchContainerT>
>;
76
77
/** \brief Constructor.
78
* \param resolution_arg: octree resolution at lowest octree level
79
* */
80
OctreePointCloudChangeDetector
(
const
double
resolution_arg)
81
:
OctreePointCloud
<PointT,
82
LeafContainerT,
83
BranchContainerT,
84
Octree2BufBase
<LeafContainerT, BranchContainerT>>(resolution_arg)
85
{}
86
87
/** \brief Get a indices from all leaf nodes that did not exist in previous buffer.
88
* \param indicesVector_arg: results are written to this vector of int indices
89
* \param minPointsPerLeaf_arg: minimum amount of points required within leaf node to
90
* become serialized.
91
* \return number of point indices
92
*/
93
std::size_t
94
getPointIndicesFromNewVoxels
(
Indices
& indicesVector_arg,
95
const
uindex_t
minPointsPerLeaf_arg = 0)
96
{
97
98
std::vector<OctreeContainerPointIndices*> leaf_containers;
99
this->
serializeNewLeafs
(leaf_containers);
100
101
for
(
const
auto
& leaf_container : leaf_containers) {
102
if
(
static_cast<
uindex_t
>
(leaf_container->getSize()) >= minPointsPerLeaf_arg)
103
leaf_container->getPointIndices(indicesVector_arg);
104
}
105
106
return
(indicesVector_arg.size());
107
}
108
};
109
}
// namespace octree
110
}
// namespace pcl
111
112
#define PCL_INSTANTIATE_OctreePointCloudChangeDetector(T) \
113
template class PCL_EXPORTS pcl::octree::OctreePointCloudChangeDetector<T>;
pcl::octree::Octree2BufBase
Octree double buffer class
Definition
octree2buf_base.h:222
pcl::octree::Octree2BufBase< OctreeContainerPointIndices, OctreeContainerEmpty >::serializeNewLeafs
void serializeNewLeafs(std::vector< OctreeContainerPointIndices * > &leaf_container_vector_arg)
Definition
octree2buf_base.hpp:339
pcl::octree::OctreeContainerEmpty
Octree container class that does not store any information.
Definition
octree_container.h:129
pcl::octree::OctreeContainerPointIndices
Octree container class that does store a vector of point indices.
Definition
octree_container.h:264
pcl::octree::OctreePointCloudChangeDetector::ConstPtr
shared_ptr< const OctreePointCloudChangeDetector< PointT, LeafContainerT, BranchContainerT > > ConstPtr
Definition
octree_pointcloud_changedetector.h:74
pcl::octree::OctreePointCloudChangeDetector::OctreePointCloudChangeDetector
OctreePointCloudChangeDetector(const double resolution_arg)
Constructor.
Definition
octree_pointcloud_changedetector.h:80
pcl::octree::OctreePointCloudChangeDetector::getPointIndicesFromNewVoxels
std::size_t getPointIndicesFromNewVoxels(Indices &indicesVector_arg, const uindex_t minPointsPerLeaf_arg=0)
Get a indices from all leaf nodes that did not exist in previous buffer.
Definition
octree_pointcloud_changedetector.h:94
pcl::octree::OctreePointCloudChangeDetector::Ptr
shared_ptr< OctreePointCloudChangeDetector< PointT, LeafContainerT, BranchContainerT > > Ptr
Definition
octree_pointcloud_changedetector.h:72
pcl::octree::OctreePointCloud< PointT, OctreeContainerPointIndices, OctreeContainerEmpty, Octree2BufBase< OctreeContainerPointIndices, OctreeContainerEmpty > >::OctreePointCloud
OctreePointCloud(const double resolution_arg)
Definition
octree_pointcloud.hpp:54
memory.h
Defines functions, macros and traits for allocating and using memory.
pcl::octree
Definition
color_coding.h:47
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133
pcl::uindex_t
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.
Definition
types.h:120