working on histogram computation

This commit is contained in:
tth 2020-09-03 01:37:53 +02:00
parent 4b2d2c264f
commit 951dc4450f
3 changed files with 41 additions and 5 deletions

View File

@ -4,7 +4,7 @@ COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \
equalize.o fimg-fits.o saturation.o
equalize.o fimg-fits.o saturation.o histogram.o
#---------------------------------------------------------------
@ -45,6 +45,9 @@ rotate.o: rotate.c $(DEPS)
saturation.o: saturation.c $(DEPS)
gcc $(COPT) -c $<
histogram.o: histogram.c $(DEPS)
gcc $(COPT) -c $<
equalize.o: equalize.c $(DEPS)
gcc $(COPT) -c $<

View File

@ -401,7 +401,36 @@ fprintf(stderr, "save as png -> %d\n", foo);
return 0;
}
/* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff };
/* func in histogram.c */
int fimg_essai_histo(FloatImg *src, char *outpic, int k);
int essai_histogramme(char *fname, int k)
{
FloatImg fimg;
int foo;
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, k);
foo = fimg_create_from_dump(fname, &fimg);
if (foo) {
fprintf(stderr, "%s: err load '%s'\n", __func__, fname);
return foo;
}
foo = fimg_essai_histo(&fimg, "out.png", k);
if (foo) {
fprintf(stderr, "essai_histo -> %d\n", foo);
return foo;
}
fprintf(stderr, "\\o/ end of %s\n", __func__);
return -1;
}
/* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo };
typedef struct {
char *name;
int Cmd;
@ -416,6 +445,7 @@ Command commands[] = {
{ "wfits", Wfits },
{ "wpng", Wpng },
{ "wtiff", Wtiff },
{ "histo", Histo },
{ NULL, 0 }
} ;
@ -506,6 +536,9 @@ switch(opt) {
case Wtiff:
foo = essai_ecriture_tiff(filename);
break;
case Histo:
foo = essai_histogramme(filename, 0);
break;
default:
fprintf(stderr, "%s : bad command\n", command);
exit(1);