Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
keypoints
impl
agast_2d.hpp
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
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of Willow Garage, Inc. nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
*/
38
39
#ifndef PCL_KEYPOINTS_AGAST_KEYPOINT_2D_IMPL_H_
40
#define PCL_KEYPOINTS_AGAST_KEYPOINT_2D_IMPL_H_
41
42
#include <pcl/common/io.h>
43
44
45
namespace
pcl
46
{
47
48
template
<
typename
Po
int
InT,
typename
Po
int
OutT,
typename
IntensityT>
bool
49
AgastKeypoint2DBase<PointInT, PointOutT, IntensityT>::initCompute
()
50
{
51
if
(!
pcl::Keypoint<PointInT, PointOutT>::initCompute
())
52
{
53
PCL_ERROR (
"[pcl::%s::initCompute] init failed.!\n"
,
name_
.c_str ());
54
return
(
false
);
55
}
56
57
if
(!
input_
->isOrganized ())
58
{
59
PCL_ERROR (
"[pcl::%s::initCompute] %s doesn't support non organized clouds!\n"
,
name_
.c_str ());
60
return
(
false
);
61
}
62
63
return
(
true
);
64
}
65
66
67
template
<
typename
Po
int
InT,
typename
Po
int
OutT>
void
68
AgastKeypoint2D<PointInT, PointOutT>::detectKeypoints
(
PointCloudOut
&output)
69
{
70
// image size
71
const
std::size_t width =
input_
->width;
72
const
std::size_t height =
input_
->height;
73
74
// destination for intensity data; will be forwarded to AGAST
75
std::vector<unsigned char> image_data (width*height);
76
77
for
(std::size_t i = 0; i < image_data.size (); ++i)
78
image_data[i] =
static_cast<
unsigned
char
>
(
intensity_
((*
input_
)[i]));
79
80
if
(!
detector_
)
81
detector_
.reset (
new
pcl::keypoints::agast::AgastDetector7_12s
(width, height,
threshold_
,
bmax_
));
82
83
detector_
->setMaxKeypoints (
nr_max_keypoints_
);
84
85
if
(
apply_non_max_suppression_
)
86
{
87
pcl::PointCloud<pcl::PointUV>
tmp_cloud;
88
detector_
->detectKeypoints (image_data, tmp_cloud);
89
90
pcl::keypoints::internal::AgastApplyNonMaxSuppresion<PointOutT>
anms (
91
image_data, tmp_cloud,
detector_
, output);
92
}
93
else
94
{
95
pcl::keypoints::internal::AgastDetector<PointOutT>
dec (
96
image_data,
detector_
, output);
97
}
98
99
// we do not change the denseness
100
output.is_dense =
true
;
101
}
102
103
}
// namespace pcl
104
105
#define AgastKeypoint2D(T,I) template class PCL_EXPORTS pcl::AgastKeypoint2D<T,I>;
106
107
#endif
108
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::threshold_
double threshold_
Definition
agast_2d.h:674
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::intensity_
pcl::common::IntensityFieldAccessor< PointInT > intensity_
Definition
agast_2d.h:671
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::bmax_
double bmax_
Definition
agast_2d.h:680
pcl::AgastKeypoint2DBase::initCompute
bool initCompute() override
Initializes everything and checks whether input data is fine.
Definition
agast_2d.hpp:49
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::detector_
AgastDetectorPtr detector_
Definition
agast_2d.h:683
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::nr_max_keypoints_
unsigned int nr_max_keypoints_
Definition
agast_2d.h:686
pcl::AgastKeypoint2DBase< PointInT, pcl::PointUV, pcl::common::IntensityFieldAccessor< PointInT > >::apply_non_max_suppression_
bool apply_non_max_suppression_
Definition
agast_2d.h:677
pcl::AgastKeypoint2D::PointCloudOut
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition
agast_2d.h:718
pcl::AgastKeypoint2D::detectKeypoints
void detectKeypoints(PointCloudOut &output) override
Detects the keypoints.
Definition
agast_2d.hpp:68
pcl::Keypoint< PointInT, PointOutT >::name_
std::string name_
Definition
keypoint.h:167
pcl::Keypoint::initCompute
virtual bool initCompute()
Definition
keypoint.hpp:51
pcl::PCLBase< PointInT >::input_
PointCloudConstPtr input_
Definition
pcl_base.h:147
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:174
pcl::keypoints::agast::AgastDetector7_12s
Detector class for AGAST corner point detector (7_12s).
Definition
agast_2d.h:267
pcl
Definition
convolution.h:46
pcl::keypoints::internal::AgastApplyNonMaxSuppresion
Definition
agast_2d.h:483
pcl::keypoints::internal::AgastDetector
Definition
agast_2d.h:512