test_chessboardgenerator.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #ifndef CV_CHESSBOARDGENERATOR_H143KJTVYM389YTNHKFDHJ89NYVMO3VLMEJNTBGUEIYVCM203P
  5. #define CV_CHESSBOARDGENERATOR_H143KJTVYM389YTNHKFDHJ89NYVMO3VLMEJNTBGUEIYVCM203P
  6. namespace cv
  7. {
  8. using std::vector;
  9. class ChessBoardGenerator
  10. {
  11. public:
  12. double sensorWidth;
  13. double sensorHeight;
  14. size_t squareEdgePointsNum;
  15. double min_cos;
  16. mutable double cov;
  17. Size patternSize;
  18. int rendererResolutionMultiplier;
  19. ChessBoardGenerator(const Size& patternSize = Size(8, 6));
  20. Mat operator()(const Mat& bg, const Mat& camMat, const Mat& distCoeffs, std::vector<Point2f>& corners) const;
  21. Mat operator()(const Mat& bg, const Mat& camMat, const Mat& distCoeffs, const Size2f& squareSize, std::vector<Point2f>& corners) const;
  22. Mat operator()(const Mat& bg, const Mat& camMat, const Mat& distCoeffs, const Size2f& squareSize, const Point3f& pos, std::vector<Point2f>& corners) const;
  23. Size cornersSize() const;
  24. mutable std::vector<Point3f> corners3d;
  25. private:
  26. void generateEdge(const Point3f& p1, const Point3f& p2, std::vector<Point3f>& out) const;
  27. Mat generateChessBoard(const Mat& bg, const Mat& camMat, const Mat& distCoeffs,
  28. const Point3f& zero, const Point3f& pb1, const Point3f& pb2,
  29. float sqWidth, float sqHeight, const std::vector<Point3f>& whole, std::vector<Point2f>& corners) const;
  30. void generateBasis(Point3f& pb1, Point3f& pb2) const;
  31. Mat rvec, tvec;
  32. };
  33. }
  34. #endif