From b80839b07647eca62bb038f876f6aaf8c7eeca6c Mon Sep 17 00:00:00 2001 From: tth Date: Wed, 4 Dec 2019 11:17:45 +0100 Subject: [PATCH] plug the funny contrast adjustement in the grabber --- doc/the_floatimg_hack.tex | 17 +++++++++++++++-- floatimg.h | 3 ++- lib/contrast.c | 1 + v4l2/grabvidseq.c | 7 +++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/the_floatimg_hack.tex b/doc/the_floatimg_hack.tex index fa75bb9..4741819 100644 --- a/doc/the_floatimg_hack.tex +++ b/doc/the_floatimg_hack.tex @@ -371,7 +371,8 @@ return 0; \end{verbatim} Je vous laisse imaginer les dégats que peut faire cette -fontion en utilisation réelle. +fontion en utilisation réelle. Mieux, je vous propose +d'essayer par vous-même. En particulier tout le reste du code qui suppose qu'un pixel ne peut \textbf{pas} être négatif. Vous pouvez aussi remarquer qu'il n'y a pas de controle @@ -439,7 +440,8 @@ en première approche, alors commençont par le plus simple, les valeurs moyennes de chaque composante. Puis nous rajouterons\footnote{Les patchs sont les bienvenus} -le calcul de la variance\index{variance}. +le calcul de la variance\index{variance}. Les compétences +de \texttt{schmod777} sont attendues au dd2\index{dd2}. \subsection{fimgfx}\index{fimgfx}\label{fimgfx} @@ -447,6 +449,17 @@ le calcul de la variance\index{variance}. Attention, je vais expérimenter un parsing un peu étrange sur les arguments de la ligne de commande. coredump expected.} +\vspace{1em} + +À l'heure actuelle\footnote{décembre 2019, vers 15:30}, nous avons +déja quelques ajustements basiques de contraste. + +\begin{verbatim} +tth@daubian:~/Devel/FloatImg/tools$ ./fimgfx -v -h +--- fimg special effects --- + cos01 cos010 pow2 sqrt +\end{verbatim} + \subsection{fimgops}\index{fimgops}\label{fimgops} Quelques opérations diverses entre deux images, qui doivent être diff --git a/floatimg.h b/floatimg.h index 9445496..fc87e49 100644 --- a/floatimg.h +++ b/floatimg.h @@ -2,7 +2,7 @@ * floatimg.h */ -#define FIMG_VERSION 79 +#define FIMG_VERSION 80 /* * in memory descriptor @@ -41,6 +41,7 @@ typedef struct { #define CONTRAST_SQRT 1 #define CONTRAST_POW2 2 #define CONTRAST_COS01 3 +#define CONTRAST_COS010 4 /* * core module diff --git a/lib/contrast.c b/lib/contrast.c index 42cf1a4..567fd36 100644 --- a/lib/contrast.c +++ b/lib/contrast.c @@ -20,6 +20,7 @@ if (!strcmp(str, "none")) return CONTRAST_NONE; if (!strcmp(str, "sqrt")) return CONTRAST_SQRT; if (!strcmp(str, "pow2")) return CONTRAST_POW2; if (!strcmp(str, "cos01")) return CONTRAST_COS01; +if (!strcmp(str, "cos010")) return CONTRAST_COS010; return -1; } diff --git a/v4l2/grabvidseq.c b/v4l2/grabvidseq.c index 2871a42..c876b7b 100644 --- a/v4l2/grabvidseq.c +++ b/v4l2/grabvidseq.c @@ -122,6 +122,10 @@ FloatImg cumul; while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:s:uv")) != -1) { switch(opt) { case 'c': contrast = fimg_id_contraste(optarg); + if (contrast < 0) { + fputs("unknow contrast\n", stderr); + exit(1); + } break; case 'd': dev_name = optarg; break; case 'g': to_gray = 1; break; @@ -344,6 +348,9 @@ switch (contrast) { case CONTRAST_COS01: fimg_cos_01(&cumul, NULL, maxvalue); break; + case CONTRAST_COS010: + fimg_cos_010(&cumul, NULL, maxvalue); + break; default: fprintf(stderr, "bad contrast method\n"); break;