|
|
|
@ -75,8 +75,9 @@ puts("\t-g\t\tconvert to gray"); |
|
|
|
|
puts("\t-n NNN\t\thow many frames ?"); |
|
|
|
|
puts("\t-O ./\t\tset Output dir"); |
|
|
|
|
puts("\t-o bla\t\tset output filename"); |
|
|
|
|
puts("\t-p NNN\t\tperiod in seconds"); |
|
|
|
|
puts("\t-p NN.N\t\tperiod in seconds"); |
|
|
|
|
puts("\t-s WxH\t\tsize of capture"); |
|
|
|
|
puts("\t-u\t\ttry upscaling..."); |
|
|
|
|
puts("\t-v\t\tincrease verbosity"); |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
@ -105,14 +106,15 @@ int width = 640; |
|
|
|
|
int height = 480; |
|
|
|
|
double t_final; |
|
|
|
|
int to_gray = 0; |
|
|
|
|
int upscaling = 0; |
|
|
|
|
char *dest_dir = "."; /* no trailing slash */ |
|
|
|
|
char *outfile = "out.pnm"; |
|
|
|
|
|
|
|
|
|
#if SAVE_AS_CUMUL |
|
|
|
|
FloatImg grab, cumul; |
|
|
|
|
FloatImg cumul; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, "d:ghn:o:O:p:s:v")) != -1) { |
|
|
|
|
while ((opt = getopt(argc, argv, "d:ghn:o:O:p:s:uv")) != -1) { |
|
|
|
|
switch(opt) { |
|
|
|
|
case 'd': dev_name = optarg; break; |
|
|
|
|
case 'g': to_gray = 1; break; |
|
|
|
@ -121,7 +123,9 @@ while ((opt = getopt(argc, argv, "d:ghn:o:O:p:s:v")) != -1) { |
|
|
|
|
case 'O': dest_dir = optarg; break; |
|
|
|
|
case 'o': outfile = optarg; break; |
|
|
|
|
case 'p': period = 1e6*atof(optarg); break; |
|
|
|
|
case 's': parse_WxH(optarg, &width, &height); break; |
|
|
|
|
case 's': parse_WxH(optarg, &width, &height); |
|
|
|
|
break; |
|
|
|
|
case 'u': upscaling = 1; break; |
|
|
|
|
case 'v': verbosity++; break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -193,12 +197,17 @@ for (i = 0; i < n_buffers; ++i) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if SAVE_AS_CUMUL |
|
|
|
|
foo = fimg_create(&grab, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, |
|
|
|
|
FIMG_TYPE_RGB); |
|
|
|
|
foo = fimg_create(&cumul, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, |
|
|
|
|
FIMG_TYPE_RGB); |
|
|
|
|
if (upscaling) { |
|
|
|
|
foo = fimg_create(&cumul, |
|
|
|
|
fmt.fmt.pix.width*2, fmt.fmt.pix.height*2, |
|
|
|
|
FIMG_TYPE_RGB); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
foo = fimg_create(&cumul, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, |
|
|
|
|
FIMG_TYPE_RGB); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fimg_clear(&cumul); |
|
|
|
|
cumul.fval = 255.0; |
|
|
|
|
cumul.count = 0; |
|
|
|
@ -256,13 +265,14 @@ for (i = 0; i < nbre_capt; i++) { |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if SAVE_AS_CUMUL |
|
|
|
|
/** this is the slow version
|
|
|
|
|
x_rgb2fimg(buffers[buf.index].start, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &grab); |
|
|
|
|
fimg_add(&grab, &cumul, &cumul); |
|
|
|
|
**/ |
|
|
|
|
x_add_rgb2fimg(buffers[buf.index].start, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &cumul); |
|
|
|
|
if (upscaling) { |
|
|
|
|
x_upscaler_0(buffers[buf.index].start, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &cumul); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
x_add_rgb2fimg(buffers[buf.index].start, |
|
|
|
|
fmt.fmt.pix.width, fmt.fmt.pix.height, &cumul); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#if SAVE_AS_FIMG |
|
|
|
@ -281,18 +291,19 @@ for (i = 0; i < nbre_capt; i++) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
t_final = fimg_timer_get(0); |
|
|
|
|
fprintf(stderr, "pid %d : elapsed time %g s\n", getpid(), t_final); |
|
|
|
|
fprintf(stderr, "\t%.2f fps\n", (double)nbre_capt / t_final); |
|
|
|
|
fprintf(stderr, "pid %d : elapsed %g s -> %.2f fps\n", getpid(), |
|
|
|
|
t_final, (double)nbre_capt / t_final); |
|
|
|
|
|
|
|
|
|
#if SAVE_AS_CUMUL |
|
|
|
|
if (to_gray) { |
|
|
|
|
if (verbosity) fputs("converting to gray\n", stderr); |
|
|
|
|
foo = fimg_to_gray(&cumul); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// save cumul to file
|
|
|
|
|
foo = fimg_save_as_pnm(&cumul, outfile, 0); |
|
|
|
|
|
|
|
|
|
// free buffers
|
|
|
|
|
fimg_destroy(&grab); |
|
|
|
|
fimg_destroy(&cumul); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|