Compare commits

..

No commits in common. "c004f22b1602130baede493fc71ef57565a610d4" and "63bc4ed7af3ee51a0ea29ffe7470ba85911a03b2" have entirely different histories.

8 changed files with 7 additions and 139 deletions

2
contrib/.gitignore vendored
View File

@ -5,5 +5,5 @@ demo_fmorph
*.tga *.tga
*.png *.png
*.pnm *.pnm
*.gif
*.fimg *.fimg
pov.stderr

View File

@ -1,18 +1,7 @@
DBGL = -DDEBUG_LEVEL=1 -g DBGL = '-DDEBUG_LEVEL=1 -g '
fimg2povhf: fimg2povhf.c Makefile fimg2povhf: fimg2povhf.c Makefile
gcc -Wall $(DBGL) $< -limage -lfloatimg -lm -o $@ gcc -Wall $(DBGL) $< -limage -lfloatimg -lm -o $@
# --------------------------------------------------------
demo_fmorph: demo_fmorph.c Makefile
gcc -Wall $(DBGL) $< -lfloatimg -lpnglite -lm -o $@
in.fimg: Makefile
mkfimg -t tpat0 -v $@ 640 480
out.png: in.fimg demo_fmorph
./demo_fmorph $< $@
# --------------------------------------------------------

View File

@ -1,116 +0,0 @@
/*
* DEMONSTRATOR FOR FMORPHO
*/
#include <stdio.h>
#include <stdlib.h>
#include <floatimg.h>
int verbosity = 1;
#define DF_W 512
#define DF_H 128
/* ~~~ -------------------------------------------------------------- +++ */
int demo_fmorph(char *srcf, char *dsti, int mode)
{
FloatImg simg, // image source
timg, uimg, // intermediaires
dimg; // destination
FimgArea51 rect;
char line[200];
int foo, pass, hpos;
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, srcf, dsti, mode);
/*
* chargement image source
*/
foo = fimg_create_from_dump(srcf, &simg);
fprintf(stderr, " load of %s --> %d\n", srcf, foo);
if (foo) {
return foo;
}
/*
* images temporaires
*/
foo = fimg_create(&timg, DF_W, DF_H, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "err %d create T img\n", foo);
return foo;
}
foo = fimg_create(&uimg, DF_W, DF_H, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "err %d create U img\n", foo);
return foo;
}
/*
* image de destination
*/
foo = fimg_create(&dimg, DF_W, DF_H*9, FIMG_TYPE_RGB);
if (foo) {
fprintf(stderr, "err %d create D img\n", foo);
return foo;
}
/*
* this is an iterator
*/
rect.x = 20; rect.y = 20;
rect.w = DF_W; rect.h = DF_H;
for (pass=0; pass<9; pass++) {
hpos = pass * DF_H;
fprintf(stderr, "pass %d, hpos %d\n", pass, hpos);
foo = fimg_extractor(&simg, &timg, &rect);
// sprintf(line, "S_%02d.png", pass);
// foo = fimg_save_as_png(&timg, line, 0);
foo = fimg_filtre_morpho_0(&timg, &uimg, pass);
if (foo) {
fprintf(stderr, "err %d filtre morpho, pass %d\n",
foo, pass);
exit(1);
}
sprintf(line, "D_%02d.png", pass);
foo = fimg_save_as_png(&uimg, line, 0);
foo = fimg_incrustator_0(&uimg, &dimg, 0, hpos, 0);
if (foo) {
fprintf(stderr, "err %d incrustator\n", foo);
exit(1);
}
}
foo = fimg_save_as_png(&dimg, dsti, 0);
/*
* do some cleanup
*/
fimg_destroy(&simg); fimg_destroy(&timg); fimg_destroy(&dimg);
return 0;
}
/* ~~~ -------------------------------------------------------------- +++ */
int main(int argc, char *argv[])
{
int foo;
fimg_print_version(1);
if (3 != argc) {
fprintf(stderr, "usage:\n\t%s src.fimg dst.png\n", argv[0]);
exit(1);
}
foo = demo_fmorph(argv[1], argv[2], 0);
fprintf(stderr, " got --> %d\n", foo);
return 0;
}
/* ~~~ -------------------------------------------------------------- +++ */

View File

@ -22,6 +22,7 @@ float minmax[6];
float rgb[3]; float rgb[3];
float dltr, dltg, dltb; /* delta des minmax */ float dltr, dltg, dltb; /* delta des minmax */
float dispx, dispy; float dispx, dispy;
int dstx, dsty; int dstx, dsty;
int in, out; int in, out;
@ -82,7 +83,9 @@ for (y=0; y<psrc->height; y++) {
fimg_put_rgb(pdst, dstx, dsty, rgb); fimg_put_rgb(pdst, dstx, dsty, rgb);
in++; in++;
} }
} }
} }
if (verbosity) fprintf(stderr, "%s -> in %d out %d\n", __func__, in, out); if (verbosity) fprintf(stderr, "%s -> in %d out %d\n", __func__, in, out);

View File

@ -171,7 +171,7 @@ unsigned char *bytes, *bptr;
double maximum, fk; double maximum, fk;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p '%s' 0x%x )\n", __func__, src, outname, flags); fprintf(stderr, ">>> %-25s ( %p '%s' 0x%x )\n", __func__, src, outname, flags);
#endif #endif
if (flags) { if (flags) {

View File

@ -123,6 +123,7 @@ fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, in, out, rect);
if (verbosity > 1) { if (verbosity > 1) {
fimg_describe(in, "extractor: source"); fimg_describe(in, "extractor: source");
fimg_describe(out, "extractor: destination"); fimg_describe(out, "extractor: destination");
// print_rectangle(rect);
} }
/* /*

View File

@ -47,9 +47,6 @@ return -1;
} }
*/ */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/*
* See also: fimg_extractor() in geometry.c
*/
int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst, int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags) int xpos, int ypos, int flags)
{ {

View File

@ -22,12 +22,6 @@ int fimg_recursion_proto(FloatImg *src, FloatImg *dst, int notused)
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, notused); fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, notused);
#endif #endif
if (notused) {
fprintf(stderr, "%s parameter notused is %d, must be 0\n",
__func__, notused);
return -2;
}
fprintf(stderr, "!!!!!! %s is a wip !!!!!\n", __func__); fprintf(stderr, "!!!!!! %s is a wip !!!!!\n", __func__);
/* /*