Fixed crash if no chessboard problem
This commit is contained in:
parent
32a33eae9b
commit
730de4d8c3
@ -10,9 +10,11 @@ using namespace cv;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
example command line (for copy-n-paste):
|
example command line when 3 cameras are connected.
|
||||||
calibration -w 6 -h 8 -s 2 -o camera.yml -op -oe image_list.xml
|
tri_calibration -w 4 -h 5 -s 0.025 -o camera_left.yml -op -oe
|
||||||
|
|
||||||
|
example command line for a list of stored images(for copy-n-paste):
|
||||||
|
tri_calibration -w 4 -h 5 -s 0.025 -o camera.yml -op -oe image_list.xml
|
||||||
where image_list.xml is the standard OpenCV XML/YAML
|
where image_list.xml is the standard OpenCV XML/YAML
|
||||||
file consisting of the list of strings, e.g.:
|
file consisting of the list of strings, e.g.:
|
||||||
|
|
||||||
@ -402,7 +404,7 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
// improve the found corners' coordinate accuracy
|
// improve the found corners' coordinate accuracy
|
||||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||||
cornerSubPix( viewGray, pointbuf, Size(11,11),
|
if(found) cornerSubPix( viewGray, pointbuf, Size(11,11),
|
||||||
Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
|
Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
|
||||||
|
|
||||||
if( mode == CAPTURING && found &&
|
if( mode == CAPTURING && found &&
|
||||||
@ -413,16 +415,21 @@ int main( int argc, char** argv )
|
|||||||
blink = capture.isOpened();
|
blink = capture.isOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawChessboardCorners( view, boardSize, Mat(pointbuf), found );
|
if(found) drawChessboardCorners( view, boardSize, Mat(pointbuf), found );
|
||||||
|
|
||||||
string msg = mode == CAPTURING ? "100/100" :
|
string msg = mode == CAPTURING ? "100/100" :
|
||||||
mode == CALIBRATED ? "Calibrated" : "Press 'g' to start";
|
mode == CALIBRATED ? "Calibrated" : "Press 'g' to start";
|
||||||
int baseLine = 0;
|
int baseLine = 0;
|
||||||
Size textSize = getTextSize(msg, 1, 1, 1, &baseLine);
|
Size textSize = getTextSize(msg, 1, 1, 1, &baseLine);
|
||||||
Point textOrigin(view.cols - textSize.width - 10, view.rows - baseLine - 10);
|
Point textOrigin(view.cols - 2*textSize.width - 10, view.rows - 2*baseLine - 10);
|
||||||
|
|
||||||
if( mode == CAPTURING )
|
if( mode == CAPTURING )
|
||||||
|
{
|
||||||
|
if(undistortImage)
|
||||||
|
msg = format( "%d/%d Undist", (int)imagePoints.size(), nframes );
|
||||||
|
else
|
||||||
msg = format( "%d/%d", (int)imagePoints.size(), nframes );
|
msg = format( "%d/%d", (int)imagePoints.size(), nframes );
|
||||||
|
}
|
||||||
|
|
||||||
putText( view, msg, textOrigin, 1, 1,
|
putText( view, msg, textOrigin, 1, 1,
|
||||||
mode != CALIBRATED ? Scalar(0,0,255) : Scalar(0,255,0));
|
mode != CALIBRATED ? Scalar(0,0,255) : Scalar(0,255,0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user