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
5#ifndef CALIB_CONTROLLER_HPP
6#define CALIB_CONTROLLER_HPP
7
8#include "calibCommon.hpp"
9
10#include <stack>
11#include <string>
12#include <ostream>
13
14namespace calib {
15
16 class calibController
17 {
18 protected:
19 cv::Ptr<calibrationData> mCalibData;
20 int mCalibFlags;
21 unsigned mMinFramesNum;
22 bool mNeedTuning;
23 bool mConfIntervalsState;
24 bool mCoverageQualityState;
25
26 double estimateCoverageQuality();
27 public:
28 calibController();
29 calibController(cv::Ptr<calibrationData> data, int initialFlags, bool autoTuning,
30 int minFramesNum);
31
32 void updateState();
33
34 bool getCommonCalibrationState() const;
35
36 bool getFramesNumberState() const;
37 bool getConfidenceIntrervalsState() const;
38 bool getRMSState() const;
39 bool getPointsCoverageState() const;
40 int getNewFlags() const;
41 };
42
43 class calibDataController
44 {
45 protected:
46 cv::Ptr<calibrationData> mCalibData;
47 std::stack<cameraParameters> mParamsStack;
48 std::string mParamsFileName;
49 unsigned mMaxFramesNum;
50 double mAlpha;
51
52 double estimateGridSubsetQuality(size_t excludedIndex);
53 public:
54 calibDataController(cv::Ptr<calibrationData> data, int maxFrames, double convParameter);
55 calibDataController();
56
57 void filterFrames();
58 void setParametersFileName(const std::string& name);
59 void deleteLastFrame();
60 void rememberCurrentParameters();
61 void deleteAllData();
62 bool saveCurrentCameraParameters() const;
63 void printParametersToConsole(std::ostream &output) const;
64 void updateUndistortMap();
65 };
66
67}
68
69#endif
70

source code of opencv/apps/interactive-calibration/calibController.hpp