handeye_target_aruco.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2019, Intel Corporation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Intel nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Yu Yan */
36 
37 #pragma once
38 
39 #include <vector>
41 
42 // opencv
43 #include <opencv2/aruco.hpp>
44 
46 {
47 class HandEyeArucoTarget : public HandEyeTargetBase
48 {
49 public:
51  ~HandEyeArucoTarget() = default;
52 
53  virtual bool initialize() override;
54 
55  virtual bool createTargetImage(cv::Mat& image) const override;
56 
57  virtual bool detectTargetPose(cv::Mat& image) override;
58 
59 protected:
60  virtual bool setTargetIntrinsicParams(int markers_x, int markers_y, int marker_size, int separation, int border_bits,
61  const std::string& dictionary_id);
62 
63  virtual bool setTargetDimension(double marker_measured_size, double marker_measured_separation);
64 
65 private:
66  // Predefined dictionary map
67  std::map<std::string, cv::aruco::PREDEFINED_DICTIONARY_NAME> marker_dictionaries_;
68 
69  // Target intrinsic params
70  int markers_x_; // Number of markers along X axis
71  int markers_y_; // Number of markers along Y axis
72  int marker_size_; // Marker size in pixels
73  int separation_; // Marker separation distance in pixels
74  int border_bits_; // Margin of boarder in bits
75  cv::aruco::PREDEFINED_DICTIONARY_NAME dictionary_id_; // Marker dictionary id
76 
77  // Target real dimensions in meters
78  double marker_size_real_; // Printed marker size
79  double marker_separation_real_; // Printed marker separation distance
80 
81  std::mutex aruco_mutex_;
82 };
83 
84 } // namespace moveit_handeye_calibration
moveit_handeye_calibration::HandEyeArucoTarget::separation_
int separation_
Definition: handeye_target_aruco.h:137
moveit_handeye_calibration::HandEyeArucoTarget::createTargetImage
virtual bool createTargetImage(cv::Mat &image) const override
Create an target image, so that the target can be viewed and printed.
Definition: handeye_target_aruco.cpp:176
moveit_handeye_calibration::HandEyeArucoTarget::setTargetDimension
virtual bool setTargetDimension(double marker_measured_size, double marker_measured_separation)
Definition: handeye_target_aruco.cpp:156
moveit_handeye_calibration::HandEyeArucoTarget::aruco_mutex_
std::mutex aruco_mutex_
Definition: handeye_target_aruco.h:145
moveit_handeye_calibration::HandEyeArucoTarget::border_bits_
int border_bits_
Definition: handeye_target_aruco.h:138
moveit_handeye_calibration::HandEyeArucoTarget::markers_x_
int markers_x_
Definition: handeye_target_aruco.h:134
moveit_handeye_calibration::HandEyeArucoTarget::setTargetIntrinsicParams
virtual bool setTargetIntrinsicParams(int markers_x, int markers_y, int marker_size, int separation, int border_bits, const std::string &dictionary_id)
Definition: handeye_target_aruco.cpp:126
moveit_handeye_calibration::HandEyeArucoTarget::dictionary_id_
cv::aruco::PREDEFINED_DICTIONARY_NAME dictionary_id_
Definition: handeye_target_aruco.h:139
moveit_handeye_calibration::HandEyeArucoTarget::~HandEyeArucoTarget
~HandEyeArucoTarget()=default
moveit_handeye_calibration::HandEyeArucoTarget::markers_y_
int markers_y_
Definition: handeye_target_aruco.h:135
moveit_handeye_calibration::HandEyeArucoTarget::marker_size_real_
double marker_size_real_
Definition: handeye_target_aruco.h:142
moveit_handeye_calibration::HandEyeArucoTarget::HandEyeArucoTarget
HandEyeArucoTarget()
Definition: handeye_target_aruco.cpp:84
moveit_handeye_calibration::HandEyeArucoTarget::marker_size_
int marker_size_
Definition: handeye_target_aruco.h:136
handeye_target_base.h
moveit_handeye_calibration::HandEyeArucoTarget::marker_separation_real_
double marker_separation_real_
Definition: handeye_target_aruco.h:143
moveit_handeye_calibration::HandEyeArucoTarget::marker_dictionaries_
std::map< std::string, cv::aruco::PREDEFINED_DICTIONARY_NAME > marker_dictionaries_
Definition: handeye_target_aruco.h:131
moveit_handeye_calibration
Definition: handeye_solver_base.h:42
moveit_handeye_calibration::HandEyeArucoTarget::detectTargetPose
virtual bool detectTargetPose(cv::Mat &image) override
Given an image containing a target captured from a camera view point, get the target pose with respec...
Definition: handeye_target_aruco.cpp:201
moveit_handeye_calibration::HandEyeArucoTarget::initialize
virtual bool initialize() override
Initialize handeye target. Call after setting the parameters.
Definition: handeye_target_aruco.cpp:101


moveit_calibration_plugins
Author(s): Yu Yan
autogenerated on Fri Oct 18 2024 02:14:08