SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
CVTrackedChessboard.h
Go to the documentation of this file.
1 /**
2  * \file CVTrackedChessboard.h
3  * \date Winter 2016
4  * \remarks Please use clangformat to format the code. See more code style on
5  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
6  * \authors Marcus Hudritsch, Michael Goettlicher
7  * \copyright http://opensource.org/licenses/GPL-3.0
8 */
9 
10 #ifndef CVCHESSBOARDTRACKER_H
11 #define CVCHESSBOARDTRACKER_H
12 
13 /*
14 The OpenCV library version 3.4 or above with extra module must be present.
15 If the application captures the live video stream with OpenCV you have
16 to define in addition the constant APP_USES_CVCAPTURE.
17 All classes that use OpenCV begin with CV.
18 See also the class docs for CVCapture, CVCalibration and CVTracked
19 for a good top down information.
20 */
21 
22 #include <CVTypedefs.h>
23 #include <CVTracked.h>
24 
25 //-----------------------------------------------------------------------------
26 //! OpenCV chessboard tracker class derived from CVTracked
27 /*! The chessboard tracker uses the same chessboard pattern as the calibration
28 class defined in CVCalibration. See CVTrackedChessboard::track for the
29 core tracking implementation.
30 */
32 {
33 public:
34  explicit CVTrackedChessboard(string calibIniPath);
35 
36  bool track(CVMat imageGray,
37  CVMat imageBgr,
38  CVCalibration* calib) final;
39 
40 private:
41  void calcBoardCorners3D(const CVSize& boardSize,
42  float squareSize,
43  CVVPoint3f& objectPoints3D);
44  bool loadCalibParams();
45 
46  string _calibParamsFileName; //< Filename of calibration parameters
47  float _edgeLengthM; //<! Length of chessboard square in meters
48  CVVPoint3f _boardPoints3D; //<! chessboard corners in world coordinate system
49  CVSize _boardSize; //<! NO. of inner chessboard corners
50  bool _solved; //<! Flag if last solvePnP was solved
51  CVMat _rVec; //<! rotation angle vector from solvePnP
52  CVMat _tVec; //<! translation vector from solvePnP
53  string _calibIniPath;
54 };
55 //-----------------------------------------------------------------------------
56 
57 #endif // CVCHESSBOARDTRACKER_H
vector< cv::Point3f > CVVPoint3f
Definition: CVTypedefs.h:79
cv::Size CVSize
Definition: CVTypedefs.h:55
cv::Mat CVMat
Definition: CVTypedefs.h:38
Live video camera calibration class with OpenCV an OpenCV calibration.
Definition: CVCalibration.h:71
OpenCV chessboard tracker class derived from CVTracked.
bool track(CVMat imageGray, CVMat imageBgr, CVCalibration *calib) final
Tracks the chessboard image in the given image for the first sceneview.
void calcBoardCorners3D(const CVSize &boardSize, float squareSize, CVVPoint3f &objectPoints3D)
CVTrackedChessboard(string calibIniPath)
CVTracked is the pure virtual base class for tracking features in video.
Definition: CVTracked.h:50