Skip to content

Instantly share code, notes, and snippets.

@cashiwamochi
Last active August 16, 2017 16:11
Show Gist options
  • Save cashiwamochi/fa1c23b3ca3b7c11c25415b6903e4a19 to your computer and use it in GitHub Desktop.
Save cashiwamochi/fa1c23b3ca3b7c11c25415b6903e4a19 to your computer and use it in GitHub Desktop.
#include "singleImageCalibration.hpp"
int main(int argc, char* argv[])
{
if(argc != 2){
showUsage();
return -1;
}
string image_name = argv[1];
Mat image = imread(image_name);
resize(image, image, Size(), 0.125, 0.125);
cout << "----- " << image_name << endl;
Size boardSize = Size(5, 4);
vector<Point2f> points_on_corners;
bool found = findChessboardCorners(image, boardSize, points_on_corners);
if (found) drawChessboardCorners(image, boardSize, Mat(points_on_corners), found);
showLinesforCalibration(points_on_corners, image);
vector<Point2f> points_on_lines = { points_on_corners[0],
points_on_corners[4],
points_on_corners[14],
points_on_corners[19] };
/* points-index
* 0(0) 4(1)
* 14(2) 19(3)
*/
namedWindow("Image for calibration",WINDOW_NORMAL);
imshow("Image for calibration",image);
Mat K = singleImageCalibration(image, points_on_lines);
cout << "Internal Parameter Matrix is " << endl;
cout << K << endl;
cout << ">> Press any key to kill this program" << endl;
waitKey(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment