From f87b175a19c02df530e84ef9e19a8b1835ca2f8b Mon Sep 17 00:00:00 2001 From: Eric Liao Date: Fri, 22 Apr 2016 14:49:43 -0700 Subject: [PATCH] Fix 6457 Allow configuration of the square size in stereo_calib. --- samples/cpp/stereo_calib.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/cpp/stereo_calib.cpp b/samples/cpp/stereo_calib.cpp index 117c9bac5d..7b3a2c70f0 100644 --- a/samples/cpp/stereo_calib.cpp +++ b/samples/cpp/stereo_calib.cpp @@ -50,13 +50,13 @@ static int print_help() " matrix separately) stereo. \n" " Calibrate the cameras and display the\n" " rectified results along with the computed disparity images. \n" << endl; - cout << "Usage:\n ./stereo_calib -w= -h= \n" << endl; + cout << "Usage:\n ./stereo_calib -w= -h= -s= \n" << endl; return 0; } static void -StereoCalib(const vector& imagelist, Size boardSize,bool displayCorners = false, bool useCalibrated=true, bool showRectified=true) +StereoCalib(const vector& imagelist, Size boardSize, float squareSize, bool displayCorners = false, bool useCalibrated=true, bool showRectified=true) { if( imagelist.size() % 2 != 0 ) { @@ -65,7 +65,6 @@ StereoCalib(const vector& imagelist, Size boardSize,bool displayCorners } const int maxScale = 2; - const float squareSize = 1.f; // Set this to your actual square size // ARRAY AND VECTOR STORAGE: vector > imagePoints[2]; @@ -348,13 +347,14 @@ int main(int argc, char** argv) Size boardSize; string imagelistfn; bool showRectified; - cv::CommandLineParser parser(argc, argv, "{w|9|}{h|6|}{nr||}{help||}{@input|../data/stereo_calib.xml|}"); + cv::CommandLineParser parser(argc, argv, "{w|9|}{h|6|}{s|1.0|}{nr||}{help||}{@input|../data/stereo_calib.xml|}"); if (parser.has("help")) return print_help(); showRectified = !parser.has("nr"); imagelistfn = parser.get("@input"); boardSize.width = parser.get("w"); boardSize.height = parser.get("h"); + float squareSize = parser.get("s"); if (!parser.check()) { parser.printErrors(); @@ -368,6 +368,6 @@ int main(int argc, char** argv) return print_help(); } - StereoCalib(imagelist, boardSize,false, true, showRectified); + StereoCalib(imagelist, boardSize, squareSize, false, true, showRectified); return 0; }