trying a new effect

This commit is contained in:
tTh 2023-07-16 12:39:49 +02:00
parent 82ffe1c2cc
commit d23a35849a
3 changed files with 40 additions and 9 deletions

View File

@ -21,6 +21,38 @@
*/ */
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
/*
* nouveau Sun Jul 16 07:37:22 UTC 2023
*/
int poke_sup_rb_g(FloatImg *src, FloatImg *dst)
{
int idx, nbpix, foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
#endif
if ( (foo=fimg_images_not_compatible(src, dst)) )
{
fprintf(stderr, "%s: no compat %d\n", __func__, foo);
return foo;
}
nbpix = src->width * src->height;
fprintf(stderr, "%s work on %d pixels\n", __func__, nbpix);
for (idx=0; idx<nbpix; idx++) {
dst->R[idx] = src->R[idx];
dst->B[idx] = src->B[idx];
if (dst->R[idx] > dst->B[idx])
dst->G[idx] = dst->R[idx];
else
dst->G[idx] = dst->B[idx];
}
return 0;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau 14 mai 2022 rue Ernest Renan */ /* nouveau 14 mai 2022 rue Ernest Renan */

View File

@ -7,6 +7,7 @@ int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k);
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k); int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);
int poke_sup_rb_g(FloatImg *src, FloatImg *dst);
int trinitron(FloatImg *pimg, int notused); int trinitron(FloatImg *pimg, int notused);

View File

@ -40,7 +40,7 @@ double debut, fin;
foo = fimg_create_from_dump(fIname, &image); foo = fimg_create_from_dump(fIname, &image);
if (foo) { if (foo) {
fprintf(stderr, "err %d create image\n", foo); fprintf(stderr, "%s: err %d create from dump\n", __func__, foo);
exit(1); exit(1);
} }
@ -73,8 +73,6 @@ return 0;
foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK); foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK);
fprintf(stderr, "essayer single -> %d\n", foo); fprintf(stderr, "essayer single -> %d\n", foo);
*/ */
int essayer_single(char *globpattern, char *destdir, int chain) int essayer_single(char *globpattern, char *destdir, int chain)
{ {
@ -161,14 +159,14 @@ puts("\t-s\tdo single test");
exit(0); exit(0);
} }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int experiment(void) int experiment(char *fname)
{ {
int foo; int foo;
FloatImg image, dest; FloatImg image, dest;
fprintf(stderr, "--------- EXPERIMENT ------------\n"); fprintf(stderr, "----- EXPERIMENT on '%s' -----\n", fname);
foo = fimg_create_from_dump("mire.fimg", &image); foo = fimg_create_from_dump(fname, &image);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d on create_from_dump\n", fprintf(stderr, "%s: err %d on create_from_dump\n",
__func__, foo); __func__, foo);
@ -177,8 +175,8 @@ if (foo) {
foo = fimg_clone(&image, &dest, 0); foo = fimg_clone(&image, &dest, 0);
foo = graylevel2popcolors(&image, &dest, 0); foo = poke_sup_rb_g(&image, &dest);
fprintf(stderr, "POP COLOR- -> %d\n", foo); fprintf(stderr, "poke sup rb g --> %d\n", foo);
fimg_export_picture(&dest, "foo.png", 0); fimg_export_picture(&dest, "foo.png", 0);
@ -230,7 +228,7 @@ if (foo) {
} }
if (do_xper) { if (do_xper) {
experiment(); experiment(infile);
return 0; return 0;
} }
if (do_single) { if (do_single) {