Compare commits

..

No commits in common. "b62b5a4805ce0cbf29e6bc815d7d214f5bc81eca" and "c7a428c5f04a989940b5cffe25f5adf24b25fd06" have entirely different histories.

8 changed files with 21 additions and 97 deletions

View File

@ -10,10 +10,4 @@
[794365.892937] usb 4-5: SerialNumber: 00000
Comment imprimer ce code trop gruik ?
enscript -o - -Ec -f Courier9 -F Times-Roman14 --word-wrap \
-i 6 --swap-even-page-margins v4l2_pr_structs.c |
ps2pdf - /media/tth/BLIRBOU/v4l2_pr_structs.pdf

View File

@ -388,9 +388,7 @@ le calcul de la variance\index{variance}.
\subsection{fimgops}\index{fimgops}\label{fimgops}
Operations diverses entre deeux images, qui doivent être
de la même taille, et du même type \textsl{pour le moment,
uniquement RGB}.
Operations diverses sur ou entre des images.
\begin{verbatim}
usage:
@ -400,16 +398,14 @@ operators:
sub 2
mix 3
mul 4
mini 5
maxi 6
options:
-g convert output to gray
-k N.N set float value
-v increase verbosity
\end{verbatim}
Pour des operateurs paramétrable (comme \texttt{mix}), le paramêtre
flottant doit être fourni en utilisant l'option \texttt{-k}.
Pour des operateurs paramétrable (comme \texttt{mix}), le paramêtre flottant doit
être fourni en utilisant l'option \texttt{-k}.
La véracité mathématique n'est pas garantie.
\subsection{fimg2png, fimg2pnm, fimg2tiff}

View File

@ -2,7 +2,7 @@
* floatimg.h
*/
#define FIMG_VERSION 77
#define FIMG_VERSION 76
/*
* in memory descriptor
@ -68,8 +68,6 @@ int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef);
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_sub(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_mul(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
/* PNM files module */
int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
@ -79,7 +77,6 @@ double fimg_timer_set(int whot);
double fimg_timer_get(int whot);
/* --> lib/contrast.c */
int fimg_id_contraste(char *name);
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);

View File

@ -12,17 +12,6 @@
extern int verbosity;
/* ---------------------------------------------------------------- */
int fimg_id_contraste(char *str)
{
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;
return -1;
}
/* ---------------------------------------------------------------- */
/*
* if the second parameter is NULL, operate 'in-place'

View File

@ -66,6 +66,7 @@ for (idx=0; idx<nbiter; idx++) {
return 0;
}
/* ---------------------------------------------------------------- */
/* ---------------------------------------------------------------- */
/*
* A * B -> D
*/
@ -93,53 +94,3 @@ for (idx=0; idx<nbiter; idx++) {
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d)
{
int idx, nbiter;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
#endif
if (3 != a->type || 3 != b->type || 3 != d->type) {
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
return -8;
}
nbiter = a->width * a->height * 3;
for (idx=0; idx<nbiter; idx++) {
if (a->R[idx] > b->R[idx])
d->R[idx] = a->R[idx];
else
d->R[idx] = b->R[idx];
}
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d)
{
int idx, nbiter;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
#endif
if (3 != a->type || 3 != b->type || 3 != d->type) {
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
return -8;
}
nbiter = a->width * a->height * 3;
for (idx=0; idx<nbiter; idx++) {
if (a->R[idx] < b->R[idx])
d->R[idx] = a->R[idx];
else
d->R[idx] = b->R[idx];
}
return 0;
}
/* ---------------------------------------------------------------- */

View File

@ -1,17 +1,13 @@
#!/bin/bash
../v4l2/grabvidseq -s 960x720 -n 100 -p 0.193 \
-vv -c none \
../v4l2/grabvidseq -s 960x720 -n 10000 -p 0.078 \
-vv -g -c none \
-o original.fimg
make t && ./t
../tools/fimgops original.fimg cos_01.fimg mini minimum.fimg
../tools/fimgops original.fimg cos_01.fimg maxi maximum.fimg
for picz in original power2 squareroot cos_01 minimum maximum
for picz in original power2 squareroot cos_01
do
echo _______________________ ${picz}

View File

@ -16,8 +16,6 @@ float global_fvalue;
#define OP_SUB 2
#define OP_MIX 3
#define OP_MUL 4
#define OP_MINI 5
#define OP_MAXI 6
typedef struct {
int code;
char *op;
@ -28,8 +26,6 @@ Opcode opcodes[] = {
{ OP_SUB, "sub" },
{ OP_MIX, "mix" },
{ OP_MUL, "mul" },
{ OP_MINI, "mini" },
{ OP_MAXI, "maxi" },
{ 0, NULL }
};
static void pr_opcodes(void)
@ -61,11 +57,11 @@ static void help(int lj)
{
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
pr_opcodes();
puts("options:");
puts("\t-g convert output to gray");
puts("\t-k N.N set float value");
puts("\t-v increase verbosity");
pr_opcodes();
if (verbosity) fimg_print_version(1);
exit(0);
}
@ -87,10 +83,6 @@ switch (action) {
break;
case OP_MUL:
foo = fimg_add(A, B, D); break;
case OP_MINI:
foo = fimg_maximum(A, B, D); break;
case OP_MAXI:
foo = fimg_minimum(A, B, D); break;
default:
foo = -99; break;
@ -133,7 +125,7 @@ if (action < 0) {
}
/*
* load the two source files, and check compatibility
* load the two source files, and check comatibility
*/
if ((foo=fimg_create_from_dump(argv[optind], &srcA))) {
fprintf(stderr, "read error on '%s' is %d\n", argv[optind], foo);

View File

@ -64,6 +64,16 @@ if (r == -1) {
}
}
/* --------------------------------------------------------------------- */
int contraste(char *str)
{
if (!strcmp(str, "sqrt")) return CONTRAST_SQRT;
if (!strcmp(str, "pow2")) return CONTRAST_POW2;
if (!strcmp(str, "cos01")) return CONTRAST_COS01;
return -1;
}
/* --------------------------------------------------------------------- */
void help(int v)
{
if (verbosity) {
@ -118,8 +128,7 @@ 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);
break;
case 'c': contrast = contraste(optarg); break;
case 'd': dev_name = optarg; break;
case 'g': to_gray = 1; break;
case 'h': help(0); break;