Made calibration a bit faster in the absense of a checkboard and trying to fix
a crash with the libv4l capture code
This commit is contained in:
parent
40c05d8418
commit
9ee954a0c6
@ -1261,9 +1261,11 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
|
|||||||
if (capture->is_v4l2_device == 1)
|
if (capture->is_v4l2_device == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
memcpy((char *)capture->frame.imageData,
|
if(capture->buffers[capture->bufferIndex].start){
|
||||||
(char *)capture->buffers[capture->bufferIndex].start,
|
memcpy((char *)capture->frame.imageData,
|
||||||
capture->frame.imageSize);
|
(char *)capture->buffers[capture->bufferIndex].start,
|
||||||
|
capture->frame.imageSize);
|
||||||
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
#endif /* HAVE_CAMV4L2 */
|
#endif /* HAVE_CAMV4L2 */
|
||||||
|
@ -404,22 +404,27 @@ int main( int argc, char** argv )
|
|||||||
flip( view, view, 0 );
|
flip( view, view, 0 );
|
||||||
|
|
||||||
vector<Point2f> pointbuf;
|
vector<Point2f> pointbuf;
|
||||||
bool found = findChessboardCorners( view, boardSize, pointbuf, CV_CALIB_CB_ADAPTIVE_THRESH );
|
|
||||||
|
|
||||||
|
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||||
|
|
||||||
|
|
||||||
|
bool found = findChessboardCorners( view, boardSize, pointbuf, CV_CALIB_CB_ADAPTIVE_THRESH & CV_CALIB_CB_FAST_CHECK & CV_CALIB_CB_NORMALIZE_IMAGE);
|
||||||
|
|
||||||
// improve the found corners' coordinate accuracy
|
// improve the found corners' coordinate accuracy
|
||||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
if(found) 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 &&
|
||||||
(!capture.isOpened() || clock() - prevTimestamp > delay*1e-3*CLOCKS_PER_SEC) )
|
(!capture.isOpened() || clock() - prevTimestamp > delay*1e-3*CLOCKS_PER_SEC) )
|
||||||
{
|
{
|
||||||
imagePoints.push_back(pointbuf);
|
imagePoints.push_back(pointbuf);
|
||||||
prevTimestamp = clock();
|
prevTimestamp = clock();
|
||||||
blink = capture.isOpened();
|
blink = capture.isOpened();
|
||||||
}
|
}
|
||||||
|
if(found) 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";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user