From 85c6e943f3a49014805e91b84555d3bed5aa42ad Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 30 Oct 2019 20:09:32 +0100 Subject: [PATCH] version UDAMA --- doc/the_floatimg_hack.tex | 31 ++++++++++++++++++++++++++++++- v4l2/grabvidseq.c | 22 +++++++++++++++------- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/doc/the_floatimg_hack.tex b/doc/the_floatimg_hack.tex index 8c2b1d8..0e25e77 100644 --- a/doc/the_floatimg_hack.tex +++ b/doc/the_floatimg_hack.tex @@ -406,6 +406,9 @@ do done \end{verbatim} +En fait, je n'ai pas la moindre idée de ce que peut bien +faire ce code\dots + % ------------------------------------------------------------------- \section{Video for Linux}\index{v4l2} @@ -433,15 +436,41 @@ options : -n NNN how many frames ? -O ./ set Output dir -o bla set output filename - -p NN.N period in seconds + -p NN.N delay between frames -s WxH size of capture -u try upscaling... -v increase verbosity \end{verbatim} +La plupart de ces options ont un usage quasi-évidents. +L'option \texttt{-s} doit correspondre à une des +résolutions possible de votre capteur. + +\subsubsection{Upscaling}\index{upscaling}\label{upscaling} + +La fonction que j'ai appelée \textsl{upscaling} est un petit +hack qui permet de doubler artificiellement la résolution +de l'image, en profitant du fait que l'on est capable +de prendre $N$ images en rafale. + +Pour être rigoureux dans la prise de vue, ce $N$ doit +être un multiple de 4. + \subsection{video-infos}\index{video-infos}\label{video-infos} Que contient, que peut faire mon périphérique \textsl{àlc} ? +Quelles sont ses possibilités de réglage ? + +\begin{verbatim} +tth@debian:~/Devel/FloatImg$ v4l2/video-infos -h +Options : + -d select the video device + -K set the K parameter + -l list video devices + -T bla add a title + -v increase verbosity +\end{verbatim} + % ------------------------------------------------------------------- \section{Et pour la suite ?} diff --git a/v4l2/grabvidseq.c b/v4l2/grabvidseq.c index e1b2a4a..faf34a9 100644 --- a/v4l2/grabvidseq.c +++ b/v4l2/grabvidseq.c @@ -301,22 +301,30 @@ for (i = 0; i < nbre_capt; i++) { puts(""); fflush(stdout); -t_final = fimg_timer_get(0); -fprintf(stderr, "pid %d : elapsed %g s -> %.2f fps\n", getpid(), +if (verbosity) { + t_final = fimg_timer_get(0); + 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); } +#if SAVE_AS_CUMUL // save cumul to file -if (verbosity) fprintf(stderr, "saving to '%s'\n", outfile); - -foo = fimg_save_as_pnm(&cumul, outfile, 1); +if (verbosity) fprintf(stderr, "saving cumul to '%s'\n", outfile); +foo = format_from_extension(outfile); +switch (foo) { + case FILE_TYPE_FIMG: + foo = fimg_dump_to_file(&cumul, outfile, 0); + break; + case FILE_TYPE_PNM: + foo = fimg_save_as_pnm(&cumul, outfile, 1); + break; + } // free buffers fimg_destroy(&cumul); #endif