Permalink
Browse files

Add -j<integer> option to skip <integer> frames prior to capture.

  • Loading branch information...
pmichaud committed Mar 30, 2011
1 parent 24f287f commit 794e6d2b464e284979d37d0e46331f9fc55df405
Showing with 11 additions and 1 deletion.
  1. +2 −1 README
  2. +9 −0 uvccapture.c
View
3 README
@@ -1,9 +1,10 @@
Uvccapture is a simple application for capturing images from an USB webcam on
Linux. This repository contains my fork and hacks on uvccapture.
-My modificantions include:
+My modifications include:
- Sequential numbering of files (img001.jpg, img002.jpg, ...).
- Command line option for number of images to capture.
+- Command line option to skip initial frames prior to capturing
- Allow capturing JPG format at any resolution supported by the camera. The
original uvccapture switches to YUYV mode at resolution 960x720 and higher,
while many cameras support MJPG at full resolution.
View
@@ -59,6 +59,8 @@ void usage (void)
"-y<height>\tImage Height (must be supported by device)\n");
fprintf (stderr,
"-c<command>\tCommand to run after each image capture(executed as <command> <output_filename>)\n");
+ fprintf (stderr,
+ "-j<integer>\tSkip <integer> frames before first capture\n");
fprintf (stderr,
"-t<integer>\tTake continuous shots with <integer> seconds between them (0 for single shot)\n");
fprintf (stderr,
@@ -194,6 +196,7 @@ int main (int argc, char *argv[])
int num = -1; /* number of images to capture */
int verbose = 0;
int delay = 0;
+ int skip = 0;
int quality = 95;
int post_capture_command_wait = 0;
int multifile = 0; /* flag indicating that we save to a multi-file sequence */
@@ -253,6 +256,10 @@ int main (int argc, char *argv[])
num = atoi (&argv[1][2]);
break;
+ case 'j':
+ skip = atoi (&argv[1][2]);
+ break;
+
case 't':
delay = atoi (&argv[1][2]);
break;
@@ -376,6 +383,8 @@ int main (int argc, char *argv[])
exit (1);
}
+ if (skip > 0) { skip--; continue; }
+
if ((difftime (time (NULL), ref_time) > delay) || delay == 0) {
if (multifile == 1) {
sprintf (thisfile, outputfile, i);

0 comments on commit 794e6d2

Please sign in to comment.