Compare commits
No commits in common. "ae7fdd49bc0aeec39c24c59d14d974bc7130bc33" and "36421bab8f08e2ed46a6c5058833126d65c2dd56" have entirely different histories.
ae7fdd49bc
...
36421bab8f
@ -69,34 +69,15 @@ 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 used both for input and
|
* This is the main filter engine
|
||||||
* output processing. It can be called by the filterstack
|
* used both for input and output
|
||||||
* processor.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DEBUG_THIS_CRAP 0
|
#define DEBUG_THIS_CRAP 0
|
||||||
@ -146,7 +127,7 @@ switch (idFx) {
|
|||||||
fimg_get_maxvalue(image)*0.8);
|
fimg_get_maxvalue(image)*0.8);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
retval = fimg_killcolors_a(image, 0.0);
|
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);
|
||||||
@ -169,11 +150,6 @@ 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;
|
||||||
|
@ -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 13:14:13"
|
FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25"
|
||||||
|
|
||||||
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 24 -kerning 0 \
|
convert foo.png -pointsize 28 -kerning 0 \
|
||||||
-fill Gray80 -undercolor Gray20 \
|
-fill Gray80 -undercolor Gray20 \
|
||||||
-font Courier-Bold \
|
-font Courier-Bold \
|
||||||
-annotate +0+23 "$txt" \
|
-annotate +0+25 "$txt" \
|
||||||
$I
|
$I
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
convert -delay 100 /tmp/fstack*.png foo.gif
|
convert -delay 150 /tmp/fstack*.png foo.gif
|
||||||
|
@ -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 (%s) failure %d\n", pattern, foo);
|
fprintf(stderr, "glob failure %d\n", 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,
|
||||||
|
@ -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, method);
|
foo = get_float_metric_from_file(filename, &metrique);
|
||||||
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.3f %5d\n", idx,
|
printf("%5d %9.6f %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,8 +140,6 @@ 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);
|
||||||
|
|
||||||
@ -187,6 +185,12 @@ 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) {
|
||||||
|
@ -13,7 +13,7 @@ extern int verbosity;
|
|||||||
/*
|
/*
|
||||||
* premier essai...
|
* premier essai...
|
||||||
*/
|
*/
|
||||||
int get_float_metric_a(FloatImg *pimg, float *where)
|
int get_float_metric(FloatImg *pimg, float *where)
|
||||||
{
|
{
|
||||||
float means[4];
|
float means[4];
|
||||||
int foo;
|
int foo;
|
||||||
@ -31,21 +31,7 @@ if (foo) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
int get_float_metric_b(FloatImg *pimg, float *where)
|
int get_float_metric_from_file(char *fname, 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;
|
||||||
@ -57,9 +43,10 @@ if (foo) {
|
|||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
fval = -1.0; /* sensible default value */
|
fval = -1.0; /* sensible default value */
|
||||||
foo = get_float_metric_b(&image, &fval);
|
foo = get_float_metric(&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;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/* first experiments */
|
/* first experiments */
|
||||||
|
|
||||||
int get_float_metric_a(FloatImg *pimg, float *where);
|
int get_float_metric(FloatImg *pimg, float *where);
|
||||||
int get_float_metric_from_file(char *imgname, float *where, int mode);
|
int get_float_metric_from_file(char *imgname, float *where);
|
||||||
|
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* ugly code from tTh
|
* ugly code from tTh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIMG_VERSION 115
|
#define FIMG_VERSION 114
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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 notused);
|
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k);
|
||||||
|
|
||||||
/* 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);
|
||||||
|
@ -52,7 +52,7 @@ for (foo=0; foo<nbb; foo++) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused)
|
int fimg_desaturate(FloatImg *src, FloatImg *dst, int k)
|
||||||
{
|
{
|
||||||
int foo, nbb;
|
int foo, nbb;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user