00001 #ifndef CHECKERBOARD_POSE_ESTIMATION_DETECTOR_H
00002 #define CHECKERBOARD_POSE_ESTIMATION_DETECTOR_H
00003
00004 #include <visual_pose_estimation/object_detector.h>
00005
00006 namespace checkerboard_pose_estimation {
00007
00008 class Detector
00009 {
00010 public:
00011 enum Side { LEFT, RIGHT };
00012
00013 Detector();
00014
00015 Detector(int width, int height, bool do_subpixel = true, Side origin_side = LEFT);
00016
00017 void setDimensions(int width, int height);
00018
00019 int width() const;
00020 int height() const;
00021
00022 bool getSubpixel() const;
00023 void setSubpixel(bool is_on);
00024
00025 Side getOriginSide() const;
00026 void setOriginSide(Side side);
00027
00028 virtual bool detect(const cv::Mat& image, std::vector<cv::Point2f>& points) const;
00029
00030 virtual void getDisplayImage(const cv::Mat& source,
00031 const std::vector<cv::Point2f>& points,
00032 bool success, cv::Mat& display) const;
00033
00034 protected:
00035 int width_;
00036 int height_;
00037 bool do_subpixel_refinement_;
00038 Side origin_side_;
00039 };
00040
00041
00042 inline Detector::Detector()
00043 : width_(0), height_(0), do_subpixel_refinement_(true), origin_side_(LEFT)
00044 {
00045 }
00046
00047 inline Detector::Detector(int width, int height, bool do_subpixel, Side origin_side)
00048 : width_(width), height_(height),
00049 do_subpixel_refinement_(do_subpixel),
00050 origin_side_(origin_side)
00051 {
00052 }
00053
00054 inline void Detector::setDimensions(int width, int height)
00055 {
00056 width_ = width;
00057 height_ = height;
00058 }
00059
00060 inline int Detector::width() const { return width_; }
00061 inline int Detector::height() const { return height_; }
00062
00063 inline bool Detector::getSubpixel() const { return do_subpixel_refinement_; }
00064 inline void Detector::setSubpixel(bool is_on) { do_subpixel_refinement_ = is_on; }
00065
00066 inline Detector::Side Detector::getOriginSide() const { return origin_side_; }
00067 inline void Detector::setOriginSide(Side side) { origin_side_ = side; }
00068
00069 }
00070
00071 #endif