random patchys...
This commit is contained in:
@@ -100,27 +100,28 @@ int r, fd = -1;
|
||||
unsigned int i, n_buffers;
|
||||
char *dev_name = "/dev/video0";
|
||||
|
||||
FILE *fout;
|
||||
// XXX FILE *fout;
|
||||
struct buffer *buffers;
|
||||
|
||||
int foo, bar;
|
||||
double period = 10.0; /* delai entre les captures */
|
||||
int nbre_capt = 1; /* nombre de captures */
|
||||
int foo;
|
||||
double period = 10.0; /* delai entre les captures */
|
||||
int nbre_capt = 1; /* nombre de captures */
|
||||
int opt;
|
||||
int width = 640;
|
||||
int height = 480;
|
||||
double t_final, maxvalue;
|
||||
int to_gray = 0;
|
||||
int upscaling = 0;
|
||||
int contrast = 0;
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
int contrast = CONTRAST_NONE;
|
||||
int rotfactor = 0; /* only 0 or 90 here */
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
char *outfile = "out.pnm";
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
FloatImg cumul;
|
||||
FloatImg cumul, tmpfimg, *to_save;
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uv")) != -1) {
|
||||
switch(opt) {
|
||||
case 'c': contrast = fimg_id_contraste(optarg);
|
||||
if (contrast < 0) {
|
||||
@@ -143,10 +144,15 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) {
|
||||
}
|
||||
period *= 1e6;
|
||||
break;
|
||||
case 'r': rotfactor = atoi(optarg); break;
|
||||
case 's': parse_WxH(optarg, &width, &height);
|
||||
break;
|
||||
case 'u': upscaling = 1; break;
|
||||
case 'v': verbosity++; break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "option '%c' is wtf\n", opt);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +161,7 @@ if (verbosity > 1) {
|
||||
fprintf(stderr, "grabing %d picz\n", nbre_capt);
|
||||
fprintf(stderr, "period is %.3f milliseconds\n", period/1e3);
|
||||
fprintf(stderr, "framesize is %dx%d\n", width, height);
|
||||
fprintf(stderr, "destdir is '%s'\n", dest_dir);
|
||||
if (upscaling) fprintf(stderr, "upscaling is on\n");
|
||||
}
|
||||
|
||||
@@ -233,6 +240,8 @@ else {
|
||||
fimg_clear(&cumul);
|
||||
cumul.fval = 255.0;
|
||||
cumul.count = 0;
|
||||
|
||||
to_save = &cumul;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -327,6 +336,7 @@ if (to_gray) {
|
||||
foo = fimg_to_gray(&cumul);
|
||||
}
|
||||
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
// save cumul to file
|
||||
if (verbosity) fprintf(stderr, "saving cumul to '%s'\n", outfile);
|
||||
@@ -357,6 +367,18 @@ switch (contrast) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* XXX warning, new from coronahome 26 mars 2020 */
|
||||
if (90 == rotfactor) {
|
||||
memset(&tmpfimg, 0, sizeof(FloatImg));
|
||||
foo = fimg_rotate_90(&cumul, &tmpfimg, 0);
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "dump rot90 %p\n", &tmpfimg);
|
||||
foo = fimg_save_as_png(&tmpfimg, "rot90.png", 0);
|
||||
}
|
||||
to_save = &tmpfimg;
|
||||
}
|
||||
|
||||
|
||||
foo = format_from_extension(outfile);
|
||||
switch (foo) {
|
||||
case FILE_TYPE_FIMG:
|
||||
@@ -373,6 +395,9 @@ switch (foo) {
|
||||
break;
|
||||
}
|
||||
// free buffers
|
||||
|
||||
|
||||
|
||||
fimg_destroy(&cumul);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user