I'm trying to calibrate my webcam but the problem is that I got just one frame 'one image' then the camera exit automatically, I couldn't recognize the problem since this is the first time I use opencv
this the code:
VideoCapture vid(0);
if (!vid.isOpened())
{
return 0;
}
int framesPerSeconds = 20;
namedWindow("webCam", CV_WINDOW_AUTOSIZE);
while (true) {
if (!vid.read(frame))
break;
vector<Vec2f> foundPoints;
bool found = false;
found = findChessboardCorners(frame, chessboardDimension, foundPoints, CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE);
frame.copyTo(drawToFrame);
drawChessboardCorners(drawToFrame, chessboardDimension,foundPoints,found);
if (found)
imshow("webCam", drawToFrame);
else
imshow("webCam", frame);
char character = waitKey(1000/ framesPerSeconds);
}
return 0;