detect_calibration_pattern.h
Go to the documentation of this file.
00001 #ifndef _DETECT_CALIBRATION_PATTERN_
00002 #define _DETECT_CALIBRATION_PATTERN_
00003 
00004 #include <opencv2/core/core.hpp>
00005 #include <opencv2/calib3d/calib3d.hpp>
00006 #include <opencv2/calib3d/calib3d.hpp>
00007 #include <opencv2/highgui/highgui.hpp>
00008 #include <opencv2/imgproc/imgproc.hpp>
00009 
00010 #include <Eigen/Dense>
00011 #include <Eigen/Geometry> 
00012 #include <Eigen/StdVector>
00013 
00014 #include <iostream>
00015 #include <stdexcept>
00016 
00017 using namespace std;
00018 
00019 enum Pattern
00020 {
00021   CHESSBOARD = 1, CIRCLES_GRID = 2, ASYMMETRIC_CIRCLES_GRID = 3
00022 };
00023 
00024 typedef std::vector<cv::Point3f> object_pts_t;
00025 typedef std::vector<cv::Point2f> observation_pts_t;
00026 
00027 void convertCVtoEigen(cv::Mat& tvec, cv::Mat& R, Eigen::Vector3f& translation, Eigen::Quaternionf& orientation);
00028 
00029 class PatternDetector
00030 {
00031   public:
00032     PatternDetector() { }
00033   
00034     static object_pts_t calcChessboardCorners(cv::Size boardSize,
00035                                           float squareSize,
00036                                           Pattern patternType = CHESSBOARD,
00037                                           cv::Point3f offset = cv::Point3f());
00038                                           
00039     int detectPattern(cv::Mat& inm, Eigen::Vector3f& translation, Eigen::Quaternionf& orientation);
00040     
00041     void setCameraMatrices(cv::Mat K_, cv::Mat D_);
00042     
00043     void setPattern(cv::Size grid_size_, float square_size_, 
00044           Pattern pattern_type_, cv::Point3f offset_ = cv::Point3f());
00045 
00046   public:
00047     cv::Mat K;
00048     cv::Mat D;
00049     cv::Mat rvec, tvec, R;
00050     
00051     // Do we need to store anything but type and ideal points?
00052     // Who knows!
00053     Pattern pattern_type;
00054     cv::Size grid_size;
00055     float square_size;
00056     object_pts_t ideal_points;
00057 };
00058 
00059 #endif


turtlebot_actions
Author(s): Helen Oleynikova, Melonee Wise
autogenerated on Wed Aug 26 2015 16:34:28