MarkerDetector.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2019, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef CORELIB_INCLUDE_RTABMAP_CORE_MARKERDETECTOR_H_
29 #define CORELIB_INCLUDE_RTABMAP_CORE_MARKERDETECTOR_H_
30 
33 #include <opencv2/opencv_modules.hpp>
34 
35 #ifdef HAVE_OPENCV_ARUCO
36 #include <opencv2/aruco.hpp>
37 #endif
38 
39 namespace rtabmap {
40 
41 typedef std::map<int, Transform> MapIdPose;
42 
43 class MarkerInfo {
44 public:
45  MarkerInfo(int id, float length, Transform pose) :
46  id_(id),
47  length_(length),
48  pose_(pose)
49  {}
50  int id() const {return id_;}
51  float length() const {return length_;}
52  const Transform & pose() const {return pose_;}
53 private:
54  int id_;
55  float length_;
57 };
58 
60 
61 public:
62  MarkerDetector(const ParametersMap & parameters = ParametersMap());
63  virtual ~MarkerDetector();
64  void parseParameters(const ParametersMap & parameters);
65 
67  MapIdPose detect(const cv::Mat & image,
68  const CameraModel & model,
69  const cv::Mat & depth = cv::Mat(),
70  float * estimatedMarkerLength = 0,
71  cv::Mat * imageWithDetections = 0), "Use the other detect(), in which the returned map contains the length of each marker detected.");
72 
73  std::map<int, MarkerInfo> detect(const cv::Mat & image,
74  const std::vector<CameraModel> & models,
75  const cv::Mat & depth = cv::Mat(),
76  const std::map<int, float> & markerLengths = std::map<int, float>(),
77  cv::Mat * imageWithDetections = 0);
78 
79  std::map<int, MarkerInfo> detect(const cv::Mat & image,
80  const CameraModel & model,
81  const cv::Mat & depth = cv::Mat(),
82  const std::map<int, float> & markerLengths = std::map<int, float>(),
83  cv::Mat * imageWithDetections = 0);
84 
85 private:
86 #ifdef HAVE_OPENCV_ARUCO
87  cv::Ptr<cv::aruco::DetectorParameters> detectorParams_;
88  float markerLength_;
89  float maxDepthError_;
90  float maxRange_;
91  float minRange_;
92  int dictionaryId_;
93  cv::Ptr<cv::aruco::Dictionary> dictionary_;
94 #endif
95 };
96 
97 } /* namespace rtabmap */
98 
99 #endif /* CORELIB_INCLUDE_RTABMAP_CORE_MARKERDETECTOR_H_ */
MarkerInfo(int id, float length, Transform pose)
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
RTABMAP_DEPRECATED(typedef SensorData Image, "rtabmap::Image class is renamed to rtabmap::SensorData, use the last one instead.")
std::map< int, Transform > MapIdPose
#define RTABMAP_EXP
Definition: RtabmapExp.h:38
float length() const
def detect(imageBuffer)
model
Definition: trace.py:4
const Transform & pose() const


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:37:29