can now select the camera for calibration

pull/13383/head
Vadim Pisarevsky 15 years ago
parent 023e2b2850
commit d6a3212084
  1. 11
      samples/c/calibration.cpp

@ -226,6 +226,8 @@ int main( int argc, char** argv )
int mode = DETECTION; int mode = DETECTION;
int undistort_image = 0; int undistort_image = 0;
CvSize img_size = {0,0}; CvSize img_size = {0,0};
int cameraId = 0;
const char* live_capture_help = const char* live_capture_help =
"When the live video from camera is used as input, the following hot-keys may be used:\n" "When the live video from camera is used as input, the following hot-keys may be used:\n"
" <ESC>, 'q' - quit the program\n" " <ESC>, 'q' - quit the program\n"
@ -318,7 +320,12 @@ int main( int argc, char** argv )
out_filename = argv[++i]; out_filename = argv[++i];
} }
else if( s[0] != '-' ) else if( s[0] != '-' )
input_filename = s; {
if( isdigit(s[0]) )
sscanf(s, "%d", &cameraId);
else
input_filename = s;
}
else else
return fprintf( stderr, "Unknown option %s", s ), -1; return fprintf( stderr, "Unknown option %s", s ), -1;
} }
@ -336,7 +343,7 @@ int main( int argc, char** argv )
mode = CAPTURING; mode = CAPTURING;
} }
else else
capture = cvCreateCameraCapture(0); capture = cvCreateCameraCapture(cameraId);
if( !capture && !f ) if( !capture && !f )
return fprintf( stderr, "Could not initialize video capture\n" ), -2; return fprintf( stderr, "Could not initialize video capture\n" ), -2;

Loading…
Cancel
Save