Skip to content

Commit

Permalink
Fix 6457
Browse files Browse the repository at this point in the history
Allow configuration of the square size in stereo_calib.
  • Loading branch information
Eric Liao committed Apr 22, 2016
1 parent ec63343 commit f87b175
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions samples/cpp/stereo_calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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=<board_width default=9> -h=<board_height default=6> <image list XML/YML file default=../data/stereo_calib.xml>\n" << endl;
cout << "Usage:\n ./stereo_calib -w=<board_width default=9> -h=<board_height default=6> -s=<square_size default=1.0> <image list XML/YML file default=../data/stereo_calib.xml>\n" << endl;
return 0;
}


static void
StereoCalib(const vector<string>& imagelist, Size boardSize,bool displayCorners = false, bool useCalibrated=true, bool showRectified=true)
StereoCalib(const vector<string>& imagelist, Size boardSize, float squareSize, bool displayCorners = false, bool useCalibrated=true, bool showRectified=true)
{
if( imagelist.size() % 2 != 0 )
{
Expand All @@ -65,7 +65,6 @@ StereoCalib(const vector<string>& 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<vector<Point2f> > imagePoints[2];
Expand Down Expand Up @@ -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<string>("@input");
boardSize.width = parser.get<int>("w");
boardSize.height = parser.get<int>("h");
float squareSize = parser.get<float>("s");
if (!parser.check())
{
parser.printErrors();
Expand All @@ -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;
}

0 comments on commit f87b175

Please sign in to comment.