Compare commits

...

6 Commits

Author SHA1 Message Date
tTh c598c4a2c0 ok boomer 2023-11-29 11:28:21 +01:00
tTh b33a752af7 bla 2023-11-29 11:26:56 +01:00
tTh 9c5849e299 filter is coming again 2023-11-29 11:25:43 +01:00
tTh 9dd2064b7a nano cleanup 2023-11-29 11:24:58 +01:00
tTh a438ab9362 better error message 2023-10-29 00:47:25 +02:00
tTh 381f329810 mute an useless message 2023-10-18 17:27:38 +02:00
11 changed files with 33 additions and 19 deletions

View File

@ -20,7 +20,7 @@
* https://git.tetalab.org/tTh/FloatImg * https://git.tetalab.org/tTh/FloatImg
*/ */
#define FIMG_VERSION (230) #define FIMG_VERSION (231)
#define RELEASE_NAME ("noname") #define RELEASE_NAME ("noname")
#define PATCH_LEVEL ("aaaa") #define PATCH_LEVEL ("aaaa")

View File

@ -46,9 +46,9 @@ float *pr, *pg, *pb; /* alias for src pix filds */
float *M; /* alias of filter matrix */ float *M; /* alias of filter matrix */
double dval; double dval;
// #if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, src, dst, filtr); fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, src, dst, filtr);
// #endif #endif
if (src->type != FIMG_TYPE_RGB) { if (src->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s: src type %d invalid\n", __func__, src->type); fprintf(stderr, "%s: src type %d invalid\n", __func__, src->type);

View File

@ -132,9 +132,11 @@ fprintf(stderr, ">>> %s ( %s %p %d )\n", __func__, str, r, notused);
if (notused) { if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n", fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__); } notused, __func__);
}
if (verbosity > 1) fprintf(stderr, "%s: parsing '%s'\n", __func__, str); if (verbosity > 1) fprintf(stderr, "%s: parsing '%s'\n", __func__, str);
foo = sscanf(str, "%d,%d,%d,%d", &w, &h, &x, &y); foo = sscanf(str, "%d,%d,%d,%d", &w, &h, &x, &y);
if (4 == foo) { if (4 == foo) {
r->x = x, r->y = y, r->w = w, r->h = h; r->x = x, r->y = y, r->w = w, r->h = h;

View File

@ -13,11 +13,17 @@ extern int verbosity; /* must be declared around main() */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_add_alpha_chan(FloatImg *img) int fimg_add_alpha_chan(FloatImg *img)
{ {
fprintf(stderr, ">>> %s ( %p )\n", __func__, img);
return -4; return -4;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_kill_alpha_chan(FloatImg *img) int fimg_kill_alpha_chan(FloatImg *img)
{ {
fprintf(stderr, ">>> %s ( %p )\n", __func__, img);
return -4; return -4;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -47,8 +47,8 @@ if (memcmp(filehead.magic, "FIMG", 4)) {
} }
/* XXX preparer la gestion des metadata */ /* XXX preparer la gestion des metadata */
if ('a' == filehead.magic[4] && verbosity) { if ('a' == filehead.magic[4] && verbosity > 1) {
fprintf(stderr,"\t****** %s have metadata\n", fname); fprintf(stderr,"*** %s have metadata\n", fname);
} }
datas[0] = filehead.w; datas[0] = filehead.w;

View File

@ -124,7 +124,7 @@ return 0;
* can compute the maxima of a lot of pictures... * can compute the maxima of a lot of pictures...
*/ */
fimg_max_of_max(FloatImg *img, float maxes[3]) int fimg_max_of_max(FloatImg *img, float maxes[3])
{ {
float localmax[3]; float localmax[3];
int idx, surface; int idx, surface;
@ -426,7 +426,8 @@ if (fi->type != FIMG_TYPE_RGB) {
return; return;
} }
nbre = fi->width * fi->height; nbre = fi->width * fi->height;
// fprintf(stderr, "%s: %d pixels\n", __func__, nbre);
fprintf(stderr, "in %s, drand48() is %f\n", __func__, drand48());
for (idx=0; idx<nbre; idx++) { for (idx=0; idx<nbre; idx++) {
fi->R[idx] = drand48() * kmul; fi->R[idx] = drand48() * kmul;

3
tools/.gitignore vendored
View File

@ -17,5 +17,8 @@ cumulfimgs
fimgops fimgops
fimgfx fimgfx
fimgmetadata fimgmetadata
fimgfilters
*.gif
*.png *.png
*.tiff *.tiff

View File

@ -13,9 +13,12 @@ DEPS = ../floatimg.h ../libfloatimg.a Makefile
all: fimg2pnm mkfimg png2fimg fimgstats fimg2png \ all: fimg2pnm mkfimg png2fimg fimgstats fimg2png \
fimg2tiff fimg2text fimg2fits \ fimg2tiff fimg2text fimg2fits \
addpnm2fimg cumulfimgs fimgops fimgfx \ addpnm2fimg cumulfimgs fimgops fimgfx \
fimgmetadata \ fimgmetadata fimgfilters \
fimghalfsize fimgextract fimghalfsize fimgextract
fimgfilters: fimgfilters.c $(DEPS)
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
fimgmetadata: fimgmetadata.c $(DEPS) fimgmetadata: fimgmetadata.c $(DEPS)
gcc $(COPT) $< ../libfloatimg.a -lm -o $@ gcc $(COPT) $< ../libfloatimg.a -lm -o $@

View File

@ -41,6 +41,7 @@ void help(int v)
puts(""); puts("");
puts("$ cumulfimgs a.fimg b.fimg c-fimg ..."); puts("$ cumulfimgs a.fimg b.fimg c-fimg ...");
puts("cumulator options :"); puts("cumulator options :");
puts("\t-a\tcompute average");
puts("\t-g\tconvert to gray level"); puts("\t-g\tconvert to gray level");
puts("\t-m\tcompute the max of the maxes"); puts("\t-m\tcompute the max of the maxes");
puts("\t-o\tname of output file"); puts("\t-o\tname of output file");
@ -140,11 +141,6 @@ if (rescale) {
fimg_div_cste(&accu, (float)compte); fimg_div_cste(&accu, (float)compte);
} }
/* XXX */
if (experiment) {
}
/* XXX */
fprintf(stderr, "max of max %9.3f %9.3f %9.3f\n", fprintf(stderr, "max of max %9.3f %9.3f %9.3f\n",
vals[0], vals[1], vals[2]); vals[0], vals[1], vals[2]);

View File

@ -102,7 +102,7 @@ if (verbosity) {
} }
if (argc==optind) { if (argc==optind) {
fprintf(stderr, "wuh ?\n"); fprintf(stderr, "what the fsck ?\n");
exit(0); exit(0);
} }

View File

@ -16,7 +16,7 @@
int verbosity; int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int filtre_image(char *infname, char *outfname) int filtre_image(char *infname, char *outfname, int type)
{ {
FloatImg src, dst; FloatImg src, dst;
int foo; int foo;
@ -30,9 +30,11 @@ static FimgFilter3x3 filtre = {
1.0/24.0, 0.0 1.0/24.0, 0.0
}; };
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, infname, outfname);
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, infname, outfname, type);
fimg_show_filter(NULL, &filtre); fimg_show_filter(NULL, &filtre);
#endif
if ((foo = fimg_create_from_dump(infname, &src))) { if ((foo = fimg_create_from_dump(infname, &src))) {
fprintf(stderr, "read error on '%s' is %d\n", infname, foo); fprintf(stderr, "read error on '%s' is %d\n", infname, foo);
@ -52,9 +54,10 @@ if (foo) {
foo = fimg_dump_to_file(&dst, outfname, 0); foo = fimg_dump_to_file(&dst, outfname, 0);
if (foo) { if (foo) {
fprintf(stderr, "dumping to file give us a %d\n", foo); fprintf(stderr, "dumping to file give us a %d\n", foo);
exit(5);
} }
return -12; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -69,7 +72,7 @@ if (3 != argc) {
fprintf(stderr, " +++ %s +++\n", argv[0]); fprintf(stderr, " +++ %s +++\n", argv[0]);
foo = filtre_image(argv[1], argv[2]); foo = filtre_image(argv[1], argv[2], 0);
fprintf(stderr, " filtrage -> %d\n", foo); fprintf(stderr, " filtrage -> %d\n", foo);
return 0; return 0;