Compare commits
No commits in common. "6a33b1d3180577b3f68b4e57a7911d2e066befec" and "f034c77401fd1cdd1f698dc7421b38337ed2b42e" have entirely different histories.
6a33b1d318
...
f034c77401
@ -898,12 +898,6 @@ sera lisible avec le sélecteur \texttt{-L}.
|
||||
\item [Déformations géométriques:] r90
|
||||
\end{description}
|
||||
|
||||
Et pour les aventureux, la commande \texttt{xper} (abréviation
|
||||
de \textsl{expérimental}) permet de tester la plus récente tentative
|
||||
de friture du moment.
|
||||
|
||||
% ---------------------
|
||||
|
||||
\subsection{fimgops}\index{fimgops}\label{fimgops}
|
||||
|
||||
Quelques opérations diverses entre deux images, qui doivent être
|
||||
|
@ -3,7 +3,7 @@
|
||||
* ugly code from tTh
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 109
|
||||
#define FIMG_VERSION 108
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -97,9 +97,6 @@ int fimg_killborders(FloatImg *img);
|
||||
int fimg_lissage_2x2(FloatImg *img);
|
||||
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
||||
|
||||
|
||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int notused);
|
||||
|
||||
/* 'sfx0' module */
|
||||
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
||||
int fimg_killcolors_b(FloatImg *fimg, float fval);
|
||||
|
@ -5,7 +5,7 @@ DEPS = ../floatimg.h Makefile
|
||||
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
|
||||
fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \
|
||||
equalize.o fimg-fits.o saturation.o histogram.o \
|
||||
hsv.o classif.o contour2x2.o
|
||||
hsv.o classif.o
|
||||
|
||||
#---------------------------------------------------------------
|
||||
|
||||
@ -55,9 +55,6 @@ equalize.o: equalize.c $(DEPS)
|
||||
sfx0.o: sfx0.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
contour2x2.o: contour2x2.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
rampes.o: rampes.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* classif.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* nouveau 4 octobre 2020, juste avant sonoptic de la pluie craignos */
|
||||
|
||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int notused)
|
||||
{
|
||||
float avg[4];
|
||||
int foo, x, y, q;
|
||||
int tbl[] =
|
||||
{
|
||||
0, 1, 1, 1,
|
||||
1, 1, 0, 1,
|
||||
1, 0, 1, 1,
|
||||
1, 1, 1, 0
|
||||
};
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||
#endif
|
||||
|
||||
foo = fimg_meanvalues(psrc, avg);
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "mean values : %f %f %f\n", avg[0], avg[1], avg[2]);
|
||||
}
|
||||
|
||||
#define RP(ix, iy) ( psrc->R[((iy)*psrc->width)+(ix)] < avg[0] )
|
||||
#define GP(ix, iy) ( psrc->G[((iy)*psrc->width)+(ix)] < avg[1] )
|
||||
#define BP(ix, iy) ( psrc->B[((iy)*psrc->width)+(ix)] < avg[2] )
|
||||
|
||||
for (y=0; y<psrc->height-1; y++) {
|
||||
|
||||
for (x=0; x<psrc->width-1; x++) {
|
||||
|
||||
q = ( ( RP(x, y) << 3 ) |
|
||||
( RP(x+1, y) << 2 ) |
|
||||
( RP(x, y+1) << 1 ) |
|
||||
( RP(x+1, y+1) ) );
|
||||
pdst->R[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||
|
||||
q = ( ( GP(x, y) << 3 ) |
|
||||
( GP(x+1, y) << 2 ) |
|
||||
( GP(x, y+1) << 1 ) |
|
||||
( GP(x+1, y+1) ) );
|
||||
pdst->G[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||
|
||||
q = ( ( BP(x, y) << 3 ) |
|
||||
( BP(x+1, y) << 2 ) |
|
||||
( BP(x, y+1) << 1 ) |
|
||||
( BP(x+1, y+1) ) );
|
||||
pdst->B[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
51
funcs/t.c
51
funcs/t.c
@ -15,47 +15,7 @@ int verbosity;
|
||||
float global_fvalue;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* nouveau 5 octobre 2020 pendant sonoptic
|
||||
*/
|
||||
int essai_contour_2x2(char *infile)
|
||||
{
|
||||
FloatImg src, dst;
|
||||
int foo;
|
||||
|
||||
if (NULL != infile) {
|
||||
fprintf(stderr, "%s : loading %s\n", __func__, infile);
|
||||
foo = fimg_create_from_dump(infile, &src);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: error loading '%s'\n", __func__, infile);
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "%s : NOT INPUT FILE, FUBAR\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
fimg_clone(&src, &dst, 1);
|
||||
|
||||
foo = fimg_contour_2x2(&src, &dst, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d in contour_2x2\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_save_as_pnm(&dst, "out.pnm", 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* nouveau 5 octobre 2020 pendant sonoptic
|
||||
*/
|
||||
int essai_classif(char *infile)
|
||||
{
|
||||
FloatImg src, dst;
|
||||
@ -76,8 +36,6 @@ else {
|
||||
|
||||
fimg_clone(&src, &dst, 1);
|
||||
|
||||
fprintf(stderr, "%s : fvalue is %f\n", __func__, global_fvalue);
|
||||
|
||||
foo = fimg_classif_trial(&src, &dst, global_fvalue, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d in classif_trial\n", __func__, foo);
|
||||
@ -511,7 +469,7 @@ return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Histo, Hsv, Classif, Ctr2x2 };
|
||||
Histo, Hsv,Classif };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@ -529,7 +487,6 @@ Command commands[] = {
|
||||
{ "histo", Histo },
|
||||
{ "hsv", Hsv },
|
||||
{ "classif", Classif },
|
||||
{ "ctr2x2", Ctr2x2 },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@ -593,8 +550,7 @@ command = argv[optind];
|
||||
filename = argv[optind+1];
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "%s : running command '%s' on '%s'\n",
|
||||
argv[0], command, filename);
|
||||
fprintf(stderr, "running command '%s' on '%s'\n", command, filename);
|
||||
fprintf(stderr, "global fvalue : %f\n", global_fvalue);
|
||||
}
|
||||
|
||||
@ -631,9 +587,6 @@ switch(opt) {
|
||||
case Classif:
|
||||
foo = essai_classif(filename);
|
||||
break;
|
||||
case Ctr2x2:
|
||||
foo = essai_contour_2x2(filename);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "%s : bad command\n", command);
|
||||
exit(1);
|
||||
|
@ -2,17 +2,15 @@
|
||||
|
||||
|
||||
src=foo.fimg
|
||||
maxi=179
|
||||
grabopt=" s 320x240 -vv -p 0 -n 100 -c none "
|
||||
maxi=90
|
||||
|
||||
grabvidseq -s 640x480 -vv -p 0 -n 2000 -c cos01 -o $src
|
||||
|
||||
for foo in $(seq 0 $maxi)
|
||||
do
|
||||
|
||||
grabvidseq -$grabopt -o $src
|
||||
|
||||
fval=$(echo "$foo / $maxi" | bc -l)
|
||||
./t -k $fval -v ctr2x2 $src
|
||||
./t -k $fval -v classif $src
|
||||
|
||||
echo $foo $fval
|
||||
|
||||
@ -23,4 +21,4 @@ do
|
||||
|
||||
done
|
||||
|
||||
convert -delay 20 v_*.pnm foo.gif
|
||||
convert -delay 10 v_*.pnm foo.gif
|
||||
|
Loading…
Reference in New Issue
Block a user