Point Cloud Library (PCL)
1.7.1
Main Page
Modules
Namespaces
Classes
recognition
include
pcl
recognition
distance_map.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
*/
37
38
#ifndef PCL_RECOGNITION_DISTANCE_MAP
39
#define PCL_RECOGNITION_DISTANCE_MAP
40
41
namespace
pcl
42
{
43
44
/** \brief Represents a distance map obtained from a distance transformation.
45
* \author Stefan Holzer
46
*/
47
class
DistanceMap
48
{
49
public
:
50
/** \brief Constructor. */
51
DistanceMap
() :
data_
(0),
width_
(0),
height_
(0) {}
52
/** \brief Destructor. */
53
virtual
~DistanceMap
() {}
54
55
/** \brief Returns the width of the map. */
56
inline
size_t
57
getWidth
()
const
58
{
59
return
(
width_
);
60
}
61
62
/** \brief Returns the height of the map. */
63
inline
size_t
64
getHeight
()
const
65
{
66
return
(
height_
);
67
}
68
69
/** \brief Returns a pointer to the beginning of map. */
70
inline
float
*
71
getData
()
72
{
73
return
(&
data_
[0]);
74
}
75
76
/** \brief Resizes the map to the specified size.
77
* \param[in] width the new width of the map.
78
* \param[in] height the new height of the map.
79
*/
80
void
81
resize
(
const
size_t
width,
const
size_t
height)
82
{
83
data_
.resize (width*height);
84
width_
= width;
85
height_
= height;
86
}
87
88
/** \brief Operator to access an element of the map.
89
* \param[in] col_index the column index of the element to access.
90
* \param[in] row_index the row index of the element to access.
91
*/
92
inline
float
&
93
operator()
(
const
size_t
col_index,
const
size_t
row_index)
94
{
95
return
(
data_
[row_index*
width_
+ col_index]);
96
}
97
98
/** \brief Operator to access an element of the map.
99
* \param[in] col_index the column index of the element to access.
100
* \param[in] row_index the row index of the element to access.
101
*/
102
inline
const
float
&
103
operator()
(
const
size_t
col_index,
const
size_t
row_index)
const
104
{
105
return
(
data_
[row_index*
width_
+ col_index]);
106
}
107
108
protected
:
109
/** \brief The storage for the distance map data. */
110
std::vector<float>
data_
;
111
/** \brief The width of the map. */
112
size_t
width_
;
113
/** \brief The height of the map. */
114
size_t
height_
;
115
};
116
117
}
118
119
120
#endif