MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / processInputData

Method processInputData

IPL/src/processes/IPLCameraCalibration.cpp:71–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71bool IPLCameraCalibration::processInputData(IPLData* data , int index, bool useOpenCV)
72{
73 _image = data->toImage();
74
75 // get properties
76 std::string fileName = getProcessPropertyString("fileName");
77 int targetType = getProcessPropertyInt("targetType");
78 int targetCols = getProcessPropertyInt("targetCols");
79 int targetRows = getProcessPropertyInt("targetRows");
80 int skipFrames = getProcessPropertyUnsignedInt("skipFrames");
81
82 std::stringstream s3;
83 s3 << "MODE: " << _mode;
84 addSuccess(s3.str());
85
86
87
88 notifyProgressEventHandler(-1);
89 cv::Mat input;
90 cv::Mat output = _image->toCvMat();
91 cv::cvtColor(_image->toCvMat(), input, CV_BGR2GRAY);
92
93 std::vector<cv::Point2f> pointBuf;
94 cv::Size boardSize(targetCols, targetRows);
95 cv::Size imageSize(_image->width(), _image->height());
96 std::vector<std::vector<cv::Point3f>> objectPoints(1);
97 cv::Mat cameraMatrix = cv::Mat::eye(3, 3, CV_64F);
98 cv::Mat distCoeffs = cv::Mat::zeros(8, 1, CV_64F);
99 std::vector<cv::Mat> rvecs, tvecs;
100 std::vector<float> reprojErrs;
101 double totalAvgErr = 0;
102
103
104 if(_mode == CALIBRATED)
105 {
106 std::stringstream s2;
107 s2 << "totalAvgErr: ";
108 s2 << totalAvgErr;
109 addInformation(s2.str());
110
111 addSuccess("Calibration successful.");
112 }
113
114 // skip a few frames when using a camera
115 if(_frameCounter < skipFrames)
116 {
117 delete _preview;
118 _preview = new IPLImage(*_image);
119 _frameCounter++;
120 return true;
121 }
122 _frameCounter = 0;
123
124 if(_mode == DETECTION)
125 {
126 bool found;
127 switch(targetType) // Find feature points on the input format
128 {

Callers

nothing calls this directly

Calls 8

runCalibrationMethod · 0.95
MatFunction · 0.85
toImageMethod · 0.80
toCvMatMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected