handeye_target_charuco.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, John Stechschulte */
36 
37 #pragma once
38 
39 #include <vector>
41 
42 // opencv
43 #include <opencv2/aruco/charuco.hpp>
44 
46 {
47 class HandEyeCharucoTarget : public HandEyeTargetBase
48 {
49 public:
51  ~HandEyeCharucoTarget() = 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_pixels, int square_size_pixels,
61  int border_size_bits, int margin_size_pixels, const std::string& dictionary_id);
62 
63  virtual bool setTargetDimension(double board_size_meters, double marker_size_meters);
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 squares_x_; // Number of squares along X axis
71  int squares_y_; // Number of squares along Y axis
72  int marker_size_pixels_; // Marker size in pixels
73  int square_size_pixels_; // Checkerboard square size in pixels
74  int border_size_bits_; // Marker border width, in bits
75  int margin_size_pixels_; // Margin of white pixels around entire board
76  cv::aruco::PREDEFINED_DICTIONARY_NAME dictionary_id_; // Marker dictionary id
77 
78  // Target real dimensions in meters
79  double board_size_meters_; // Printed board size, longest dimension
80  double marker_size_meters_; // Printed marker size
81 
82  std::mutex charuco_mutex_;
83 };
84 
85 } // namespace moveit_handeye_calibration
moveit_handeye_calibration::HandEyeCharucoTarget::dictionary_id_
cv::aruco::PREDEFINED_DICTIONARY_NAME dictionary_id_
Definition: handeye_target_charuco.h:140
moveit_handeye_calibration::HandEyeCharucoTarget::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_charuco.cpp:186
moveit_handeye_calibration::HandEyeCharucoTarget::marker_dictionaries_
std::map< std::string, cv::aruco::PREDEFINED_DICTIONARY_NAME > marker_dictionaries_
Definition: handeye_target_charuco.h:131
moveit_handeye_calibration::HandEyeCharucoTarget::border_size_bits_
int border_size_bits_
Definition: handeye_target_charuco.h:138
moveit_handeye_calibration::HandEyeCharucoTarget::squares_x_
int squares_x_
Definition: handeye_target_charuco.h:134
moveit_handeye_calibration::HandEyeCharucoTarget::~HandEyeCharucoTarget
~HandEyeCharucoTarget()=default
moveit_handeye_calibration::HandEyeCharucoTarget::setTargetDimension
virtual bool setTargetDimension(double board_size_meters, double marker_size_meters)
Definition: handeye_target_charuco.cpp:163
handeye_target_base.h
moveit_handeye_calibration::HandEyeCharucoTarget::HandEyeCharucoTarget
HandEyeCharucoTarget()
Definition: handeye_target_charuco.cpp:84
moveit_handeye_calibration
Definition: handeye_solver_base.h:42
moveit_handeye_calibration::HandEyeCharucoTarget::margin_size_pixels_
int margin_size_pixels_
Definition: handeye_target_charuco.h:139
moveit_handeye_calibration::HandEyeCharucoTarget::squares_y_
int squares_y_
Definition: handeye_target_charuco.h:135
moveit_handeye_calibration::HandEyeCharucoTarget::setTargetIntrinsicParams
virtual bool setTargetIntrinsicParams(int markers_x, int markers_y, int marker_size_pixels, int square_size_pixels, int border_size_bits, int margin_size_pixels, const std::string &dictionary_id)
Definition: handeye_target_charuco.cpp:129
moveit_handeye_calibration::HandEyeCharucoTarget::marker_size_meters_
double marker_size_meters_
Definition: handeye_target_charuco.h:144
moveit_handeye_calibration::HandEyeCharucoTarget::square_size_pixels_
int square_size_pixels_
Definition: handeye_target_charuco.h:137
moveit_handeye_calibration::HandEyeCharucoTarget::initialize
virtual bool initialize() override
Initialize handeye target. Call after setting the parameters.
Definition: handeye_target_charuco.cpp:102
moveit_handeye_calibration::HandEyeCharucoTarget::marker_size_pixels_
int marker_size_pixels_
Definition: handeye_target_charuco.h:136
moveit_handeye_calibration::HandEyeCharucoTarget::board_size_meters_
double board_size_meters_
Definition: handeye_target_charuco.h:143
moveit_handeye_calibration::HandEyeCharucoTarget::charuco_mutex_
std::mutex charuco_mutex_
Definition: handeye_target_charuco.h:146
moveit_handeye_calibration::HandEyeCharucoTarget::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_charuco.cpp:213


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