added "qsortrgb" effect

This commit is contained in:
2020-10-08 11:24:29 +02:00
parent bbee507851
commit ceb806d19c
3 changed files with 93 additions and 2 deletions

View File

@@ -14,6 +14,48 @@ int verbosity;
float global_fvalue;
/* --------------------------------------------------------------------- */
/*
* nouveau 7 octobre 2020 pendant sonoptic
*/
int fimg_qsort_rgb(FloatImg *psrc, FloatImg *pdst, int notused);
int essai_qsort_rgb(char *infile)
{
FloatImg src, dst;
int foo;
if (NULL != infile) {
fprintf(stderr, "%s : loading %s\n", __func__, infile);
foo = fimg_create_from_dump(infile, &src);
if (foo) {
fprintf(stderr, "%s: error loading '%s'\n", __func__, infile);
return foo;
}
}
else {
fprintf(stderr, "%s : NOT INPUT FILE, FUBAR\n", __func__);
abort();
}
fimg_clone(&src, &dst, 1);
foo = fimg_qsort_rgb(&src, &dst, 0);
if (foo) {
fprintf(stderr, "%s: err %d in qsort_rgb\n", __func__, foo);
return foo;
}
foo = fimg_save_as_pnm(&dst, "out.pnm", 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
return 0;
}
/* --------------------------------------------------------------------- */
/*
* nouveau 5 octobre 2020 pendant sonoptic
@@ -511,7 +553,7 @@ return 0;
}
/* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo, Hsv, Classif, Ctr2x2 };
Histo, Hsv, Classif, Ctr2x2, Qsortrgb };
typedef struct {
char *name;
int Cmd;
@@ -530,6 +572,7 @@ Command commands[] = {
{ "hsv", Hsv },
{ "classif", Classif },
{ "ctr2x2", Ctr2x2 },
{ "qsortrgb", Qsortrgb },
{ NULL, 0 }
} ;
@@ -634,6 +677,9 @@ switch(opt) {
case Ctr2x2:
foo = essai_contour_2x2(filename);
break;
case Qsortrgb:
foo = essai_qsort_rgb(filename);
break;
default:
fprintf(stderr, "%s : bad command\n", command);
exit(1);