Compare commits
No commits in common. "b62b5a4805ce0cbf29e6bc815d7d214f5bc81eca" and "c7a428c5f04a989940b5cffe25f5adf24b25fd06" have entirely different histories.
b62b5a4805
...
c7a428c5f0
@ -10,10 +10,4 @@
|
|||||||
[794365.892937] usb 4-5: SerialNumber: 00000
|
[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
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -388,9 +388,7 @@ le calcul de la variance\index{variance}.
|
|||||||
|
|
||||||
\subsection{fimgops}\index{fimgops}\label{fimgops}
|
\subsection{fimgops}\index{fimgops}\label{fimgops}
|
||||||
|
|
||||||
Operations diverses entre deeux images, qui doivent être
|
Operations diverses sur ou entre des images.
|
||||||
de la même taille, et du même type \textsl{pour le moment,
|
|
||||||
uniquement RGB}.
|
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
usage:
|
usage:
|
||||||
@ -400,16 +398,14 @@ operators:
|
|||||||
sub 2
|
sub 2
|
||||||
mix 3
|
mix 3
|
||||||
mul 4
|
mul 4
|
||||||
mini 5
|
|
||||||
maxi 6
|
|
||||||
options:
|
options:
|
||||||
-g convert output to gray
|
-g convert output to gray
|
||||||
-k N.N set float value
|
-k N.N set float value
|
||||||
-v increase verbosity
|
-v increase verbosity
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
Pour des operateurs paramétrable (comme \texttt{mix}), le paramêtre
|
Pour des operateurs paramétrable (comme \texttt{mix}), le paramêtre flottant doit
|
||||||
flottant doit être fourni en utilisant l'option \texttt{-k}.
|
être fourni en utilisant l'option \texttt{-k}.
|
||||||
La véracité mathématique n'est pas garantie.
|
La véracité mathématique n'est pas garantie.
|
||||||
|
|
||||||
\subsection{fimg2png, fimg2pnm, fimg2tiff}
|
\subsection{fimg2png, fimg2pnm, fimg2tiff}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* floatimg.h
|
* floatimg.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIMG_VERSION 77
|
#define FIMG_VERSION 76
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in memory descriptor
|
* 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_add(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||||
int fimg_sub(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_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 */
|
/* PNM files module */
|
||||||
int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
|
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);
|
double fimg_timer_get(int whot);
|
||||||
|
|
||||||
/* --> lib/contrast.c */
|
/* --> lib/contrast.c */
|
||||||
int fimg_id_contraste(char *name);
|
|
||||||
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
|
int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
|
||||||
int fimg_power_2(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);
|
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
|
||||||
|
@ -12,17 +12,6 @@
|
|||||||
|
|
||||||
extern int verbosity;
|
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'
|
* if the second parameter is NULL, operate 'in-place'
|
||||||
|
@ -66,6 +66,7 @@ for (idx=0; idx<nbiter; idx++) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
|
/* ---------------------------------------------------------------- */
|
||||||
/*
|
/*
|
||||||
* A * B -> D
|
* A * B -> D
|
||||||
*/
|
*/
|
||||||
@ -93,53 +94,3 @@ for (idx=0; idx<nbiter; idx++) {
|
|||||||
return 0;
|
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;
|
|
||||||
}
|
|
||||||
/* ---------------------------------------------------------------- */
|
|
||||||
|
10
lib/runme.sh
10
lib/runme.sh
@ -1,17 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
../v4l2/grabvidseq -s 960x720 -n 100 -p 0.193 \
|
../v4l2/grabvidseq -s 960x720 -n 10000 -p 0.078 \
|
||||||
-vv -c none \
|
-vv -g -c none \
|
||||||
-o original.fimg
|
-o original.fimg
|
||||||
|
|
||||||
make t && ./t
|
make t && ./t
|
||||||
|
|
||||||
../tools/fimgops original.fimg cos_01.fimg mini minimum.fimg
|
for picz in original power2 squareroot cos_01
|
||||||
../tools/fimgops original.fimg cos_01.fimg maxi maximum.fimg
|
|
||||||
|
|
||||||
|
|
||||||
for picz in original power2 squareroot cos_01 minimum maximum
|
|
||||||
do
|
do
|
||||||
|
|
||||||
echo _______________________ ${picz}
|
echo _______________________ ${picz}
|
||||||
|
@ -16,8 +16,6 @@ float global_fvalue;
|
|||||||
#define OP_SUB 2
|
#define OP_SUB 2
|
||||||
#define OP_MIX 3
|
#define OP_MIX 3
|
||||||
#define OP_MUL 4
|
#define OP_MUL 4
|
||||||
#define OP_MINI 5
|
|
||||||
#define OP_MAXI 6
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int code;
|
int code;
|
||||||
char *op;
|
char *op;
|
||||||
@ -28,8 +26,6 @@ Opcode opcodes[] = {
|
|||||||
{ OP_SUB, "sub" },
|
{ OP_SUB, "sub" },
|
||||||
{ OP_MIX, "mix" },
|
{ OP_MIX, "mix" },
|
||||||
{ OP_MUL, "mul" },
|
{ OP_MUL, "mul" },
|
||||||
{ OP_MINI, "mini" },
|
|
||||||
{ OP_MAXI, "maxi" },
|
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
static void pr_opcodes(void)
|
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");
|
puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg");
|
||||||
|
pr_opcodes();
|
||||||
puts("options:");
|
puts("options:");
|
||||||
puts("\t-g convert output to gray");
|
puts("\t-g convert output to gray");
|
||||||
puts("\t-k N.N set float value");
|
puts("\t-k N.N set float value");
|
||||||
puts("\t-v increase verbosity");
|
puts("\t-v increase verbosity");
|
||||||
pr_opcodes();
|
|
||||||
if (verbosity) fimg_print_version(1);
|
if (verbosity) fimg_print_version(1);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -87,10 +83,6 @@ switch (action) {
|
|||||||
break;
|
break;
|
||||||
case OP_MUL:
|
case OP_MUL:
|
||||||
foo = fimg_add(A, B, D); break;
|
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:
|
default:
|
||||||
foo = -99; break;
|
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))) {
|
if ((foo=fimg_create_from_dump(argv[optind], &srcA))) {
|
||||||
fprintf(stderr, "read error on '%s' is %d\n", argv[optind], foo);
|
fprintf(stderr, "read error on '%s' is %d\n", argv[optind], foo);
|
||||||
|
@ -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)
|
void help(int v)
|
||||||
{
|
{
|
||||||
if (verbosity) {
|
if (verbosity) {
|
||||||
@ -118,8 +128,7 @@ FloatImg cumul;
|
|||||||
|
|
||||||
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:s:uv")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'c': contrast = fimg_id_contraste(optarg);
|
case 'c': contrast = contraste(optarg); break;
|
||||||
break;
|
|
||||||
case 'd': dev_name = optarg; break;
|
case 'd': dev_name = optarg; break;
|
||||||
case 'g': to_gray = 1; break;
|
case 'g': to_gray = 1; break;
|
||||||
case 'h': help(0); break;
|
case 'h': help(0); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user