working on histogram computation

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

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);