Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
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
45namespace pcl
46{
47
48template <typename PointInT, typename PointOutT, typename IntensityT> bool
50{
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
67template <typename PointInT, typename PointOutT> void
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 {
88 detector_->detectKeypoints (image_data, tmp_cloud);
89
91 image_data, tmp_cloud, detector_, output);
92 }
93 else
94 {
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
bool initCompute() override
Initializes everything and checks whether input data is fine.
Definition agast_2d.hpp:49
typename Keypoint< PointInT, PointOutT >::PointCloudOut PointCloudOut
Definition agast_2d.h:722
void detectKeypoints(PointCloudOut &output) override
Detects the keypoints.
Definition agast_2d.hpp:68
Keypoint represents the base class for key points.
Definition keypoint.h:49
PointCloud represents the base class in PCL for storing collections of 3D points.
Detector class for AGAST corner point detector (7_12s).
Definition agast_2d.h:267