Compare commits

..

7 Commits

Author SHA1 Message Date
phyto
ae7fdd49bc still tweaking... 2020-12-07 22:02:08 +01:00
phyto
8668e15d3e desaturate added to crapulator 2020-12-07 12:52:17 +01:00
phyto
16c7d1ec4a bla & version bump 2020-12-07 11:16:26 +01:00
phyto
1420deaf5e renaming a func 2020-12-07 10:30:18 +01:00
phyto
da8cfd1305 XXX WTF OMG 2020-12-07 10:29:48 +01:00
phyto
de1edceaf3 bla 2020-12-07 10:11:54 +01:00
phyto
6ea654019c bla 2020-12-07 10:00:54 +01:00
8 changed files with 62 additions and 29 deletions

View File

@ -69,15 +69,34 @@ if (retval) {
fprintf(stderr, "%s error %d on filter\n", __func__, retval); fprintf(stderr, "%s error %d on filter\n", __func__, retval);
exit(1); exit(1);
} }
fimg_killborders(&img); /* XXX WTF OMG */
fimg_copy_data(&img, pimg); fimg_copy_data(&img, pimg);
fimg_destroy(&img); fimg_destroy(&img);
return retval; return retval;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static int desaturate(FloatImg *pimg)
{
FloatImg img;
int retval;
fimg_clone(pimg, &img, 0);
retval = fimg_desaturate(pimg, &img, 0);
if (retval) {
fprintf(stderr, "%s : err desaturate %d\n",
__func__, retval);
exit(1);
}
fimg_copy_data(&img, pimg);
fimg_destroy(&img);
return 0;
}
/* -------------------------------------------------------------- */
/* /*
* This is the main filter engine * This is the main filter engine used both for input and
* used both for input and output * output processing. It can be called by the filterstack
* processor.
*/ */
#define DEBUG_THIS_CRAP 0 #define DEBUG_THIS_CRAP 0
@ -127,7 +146,7 @@ switch (idFx) {
fimg_get_maxvalue(image)*0.8); fimg_get_maxvalue(image)*0.8);
break; break;
case 6: case 6:
fimg_killcolors_a(image, 0.0); retval = fimg_killcolors_a(image, 0.0);
break; break;
case 7: case 7:
retval = fimg_colors_mixer_a(image, 2.0); retval = fimg_colors_mixer_a(image, 2.0);
@ -150,6 +169,11 @@ switch (idFx) {
case 13: case 13:
retval = insitu_filtre3x3(image); retval = insitu_filtre3x3(image);
break; break;
case 14:
retval = desaturate(image);
break;
/* here are the glitches */
case 24: /* experiment ! */ case 24: /* experiment ! */
retval = des_bords_sombres_a(image, 160); retval = des_bords_sombres_a(image, 160);
break; break;

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25" FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13"
rm /tmp/fstack*.png rm /tmp/fstack*.png
@ -11,12 +11,12 @@ do
echo ; echo $I echo ; echo $I
./t -F $F ./t -F $F
txt=$(printf "[%-10s]" $F) txt=$(printf "[%-10s]" $F)
convert foo.png -pointsize 28 -kerning 0 \ convert foo.png -pointsize 24 -kerning 0 \
-fill Gray80 -undercolor Gray20 \ -fill Gray80 -undercolor Gray20 \
-font Courier-Bold \ -font Courier-Bold \
-annotate +0+25 "$txt" \ -annotate +0+23 "$txt" \
$I $I
done done
convert -delay 150 /tmp/fstack*.png foo.gif convert -delay 100 /tmp/fstack*.png foo.gif

View File

@ -89,7 +89,7 @@ else fprintf(stderr, "\tno out fx\n");
memset(&globbuf, 0, sizeof(glob_t)); memset(&globbuf, 0, sizeof(glob_t));
foo = glob(pattern, 0, NULL, &globbuf); foo = glob(pattern, 0, NULL, &globbuf);
if (foo) { if (foo) {
fprintf(stderr, "glob failure %d\n", foo); fprintf(stderr, "glob (%s) failure %d\n", pattern, foo);
exit(1); exit(1);
} }
@ -217,8 +217,8 @@ while ((opt = getopt(argc, argv, "B:ghI:O:s:T:vw:x:")) != -1) {
} }
if (verbosity) { if (verbosity) {
fprintf(stderr, "input glob %s\n", in_pattern); fprintf(stderr, "input glob '%s'\n", in_pattern);
fprintf(stderr, "output dir %s\n", out_dir); fprintf(stderr, "output dir '%s'\n", out_dir);
} }
foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect, foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect,

View File

@ -66,7 +66,7 @@ fprintf(stderr, "IdxValues array at %p\n", idxvalues);
/* compute all the needed values */ /* compute all the needed values */
for (idx=0; idx<nombre; idx++) { for (idx=0; idx<nombre; idx++) {
filename = ptr_glob->gl_pathv[idx]; filename = ptr_glob->gl_pathv[idx];
foo = get_float_metric_from_file(filename, &metrique); foo = get_float_metric_from_file(filename, &metrique, method);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d get metric of '%s'\n", __func__, fprintf(stderr, "%s: err %d get metric of '%s'\n", __func__,
foo, filename); foo, filename);
@ -80,18 +80,18 @@ for (idx=0; idx<nombre; idx++) {
if (method) { if (method) {
/* and now, we can massage all our datas */ /* and now, we can massage all our datas */
fprintf(stderr, "sorting %d ...\n", method); // fprintf(stderr, "sorting %d ...\n", method);
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues); qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
} }
if (verbosity > 1) { if (verbosity > 1) {
for (idx=0; idx<nombre; idx++) { for (idx=0; idx<nombre; idx++) {
printf("%5d %9.6f %5d\n", idx, printf("%5d %9.3f %5d\n", idx,
idxvalues[idx].value, idxvalues[idx].idx); idxvalues[idx].value, idxvalues[idx].idx);
fflush(stdout); fflush(stdout);
} }
} }
fprintf(stderr, "\n.\n");
return 0; return 0;
} }
@ -140,6 +140,8 @@ w = iarray[0], h = iarray[1];
fprintf(stderr, "first image size : %dx%d\n", w, h); fprintf(stderr, "first image size : %dx%d\n", w, h);
fimg_create(&A, w, h, 3); pFirst = &A; fimg_create(&A, w, h, 3); pFirst = &A;
fimg_vdeg_a(&A, idx_values[0].value);
fimg_create(&B, w, h, 3); pSecond = &B; fimg_create(&B, w, h, 3); pSecond = &B;
fimg_create(&Out, w, h, 3); fimg_create(&Out, w, h, 3);
@ -185,12 +187,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
return foo; return foo;
} }
if (foo) {
fprintf(stderr, "\n%s: out fx %d failure %d\n",
__func__, outfx, foo);
exit(1);
}
sprintf(line, "%s/%05d.png", outdir, ipng); sprintf(line, "%s/%05d.png", outdir, ipng);
foo = fimg_save_as_png(&Out, line, 0); foo = fimg_save_as_png(&Out, line, 0);
if (foo) { if (foo) {

View File

@ -13,7 +13,7 @@ extern int verbosity;
/* /*
* premier essai... * premier essai...
*/ */
int get_float_metric(FloatImg *pimg, float *where) int get_float_metric_a(FloatImg *pimg, float *where)
{ {
float means[4]; float means[4];
int foo; int foo;
@ -31,7 +31,21 @@ if (foo) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int get_float_metric_from_file(char *fname, float *where) int get_float_metric_b(FloatImg *pimg, float *where)
{
int idx, size;
double adder;
adder = 0.0;
size = pimg->width * pimg->height;
for (idx=20; idx < size; idx+=42) {
adder += (double)pimg->R[idx];
}
*where = (float)adder;
return 0;
}
/* -------------------------------------------------------------- */
int get_float_metric_from_file(char *fname, float *where, int mode)
{ {
FloatImg image; FloatImg image;
int foo; int foo;
@ -43,10 +57,9 @@ if (foo) {
return foo; return foo;
} }
fval = -1.0; /* sensible default value */ fval = -1.0; /* sensible default value */
foo = get_float_metric(&image, &fval); foo = get_float_metric_b(&image, &fval);
*where = fval; *where = fval;
// fprintf(stderr, "metric of '%s' = %f\n", fname, fval);
fimg_destroy(&image); fimg_destroy(&image);
return 0; return 0;

View File

@ -6,7 +6,7 @@
/* first experiments */ /* first experiments */
int get_float_metric(FloatImg *pimg, float *where); int get_float_metric_a(FloatImg *pimg, float *where);
int get_float_metric_from_file(char *imgname, float *where); int get_float_metric_from_file(char *imgname, float *where, int mode);
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -3,7 +3,7 @@
* ugly code from tTh * ugly code from tTh
*/ */
#define FIMG_VERSION 114 #define FIMG_VERSION 115
/* /*
* in memory descriptor * in memory descriptor
@ -140,7 +140,7 @@ int fimg_qsort_rgb_b(FloatImg *psrc, FloatImg *pdst, int notused);
int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax); int fimg_equalize_compute(FloatImg *src, void *vptr, float vmax);
int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k); int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k); int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused);
/* module funcs/geometry.c */ /* module funcs/geometry.c */
int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused); int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused);

View File

@ -52,7 +52,7 @@ for (foo=0; foo<nbb; foo++) {
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k) int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused)
{ {
int foo, nbb; int foo, nbb;