39 #ifndef VPPLANAROBJECTDETECTOR_H_ 40 #define VPPLANAROBJECTDETECTOR_H_ 42 #include <visp3/core/vpConfig.h> 44 #if (VISP_HAVE_OPENCV_VERSION >= 0x020000) && \ 45 (VISP_HAVE_OPENCV_VERSION < 0x030000) // Require opencv >= 2.0.0 and < 3.0.0 47 #if (VISP_HAVE_OPENCV_VERSION >= 0x020101) // Require opencv >= 2.1.1 48 #include <opencv2/calib3d/calib3d.hpp> 49 #include <opencv2/features2d/features2d.hpp> 50 #include <opencv2/imgproc/imgproc.hpp> 51 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020000) // Require opencv >= 2.0.0 56 #include <visp3/core/vpCameraParameters.h> 57 #include <visp3/core/vpHomogeneousMatrix.h> 58 #include <visp3/core/vpImage.h> 59 #include <visp3/core/vpImagePoint.h> 60 #include <visp3/core/vpPoint.h> 61 #include <visp3/core/vpRect.h> 62 #include <visp3/vision/vpFernClassifier.h> 63 #include <visp3/vision/vpHomography.h> 141 class VISP_EXPORT vpPlanarObjectDetector
146 vpFernClassifier fern;
155 std::vector<cv::Point2f> dst_corners;
161 std::vector<cv::Point2f> ref_corners;
168 std::vector<vpImagePoint> currentImagePoints;
171 std::vector<vpImagePoint> refImagePoints;
175 unsigned int minNbMatching;
179 vpPlanarObjectDetector();
180 vpPlanarObjectDetector(
const std::string &dataFile,
const std::string &objectName);
181 virtual ~vpPlanarObjectDetector();
193 const unsigned int width);
196 void recordDetector(
const std::string &objectName,
const std::string &dataFile);
197 void load(
const std::string &dataFilename,
const std::string &objName);
209 std::vector<vpImagePoint> getDetectedCorners()
const;
216 vpFernClassifier &getFernClassifier() {
return this->fern; }
224 inline void getHomography(
vpHomography &_H)
const { _H = this->homography; }
231 inline unsigned int getNbRefPoints() {
return (
unsigned int)currentImagePoints.
size(); }
241 void getReferencePoint(
const unsigned int _i,
vpImagePoint &_imPoint);
262 void setMinNbPointValidation(
const unsigned int _min) { this->minNbMatching = _min; }
270 unsigned int getMinNbPointValidation()
const {
return this->minNbMatching; }
274 void computeRoi(
vpImagePoint *ip,
const unsigned int nbpt);
275 void initialiseRefCorners(
const cv::Rect &_modelROI);
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of an homography and operations on homographies.
Defines a rectangle in the plane.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...