first version of displacement mapping

This commit is contained in:
2020-10-26 16:45:36 +01:00
parent f04f37ce43
commit 3e820c8298
4 changed files with 142 additions and 6 deletions

View File

@@ -14,6 +14,39 @@ int verbosity;
float global_fvalue;
/* --------------------------------------------------------------------- */
/* nouveau 24 octobre 2020, pendant le masque-flamme coronavidique */
int fimg_displacement_0(FloatImg *psrc, FloatImg *pdst, int flags);
int essai_displacement(char *infile, char *outfile)
{
int foo;
FloatImg src, dst;
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;
}
fimg_clone(&src, &dst, 1);
foo = fimg_displacement_0(&src, &dst, 0);
if (foo) {
fprintf(stderr, "%s: err %d in disp map 0\n", __func__, foo);
return foo;
}
foo = fimg_export_picture(&dst, outfile, 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
return 0;
}
/* --------------------------------------------------------------------- */
/*
* nouveau 7 octobre 2020 pendant sonoptic
@@ -557,7 +590,8 @@ return 0;
}
/* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo, Hsv, Classif, Ctr2x2, Qsortrgb };
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
Displace };
typedef struct {
char *name;
int Cmd;
@@ -577,6 +611,7 @@ Command commands[] = {
{ "classif", Classif },
{ "ctr2x2", Ctr2x2 },
{ "qsortrgb", Qsortrgb },
{ "displace", Displace },
{ NULL, 0 }
} ;
@@ -620,10 +655,11 @@ int foo, opt;
char *filename, *command, *outfile;
fprintf(stderr, "++++++++ test des fonctions pid=%d\n", getpid());
fprintf(stderr, "++++++++ compiled "__DATE__" at " __TIME__ "\n");
global_fvalue = 1.0;
outfile = "out.pnm";
command = "none";
while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
switch(opt) {
@@ -690,6 +726,9 @@ switch(opt) {
case Qsortrgb:
foo = essai_qsort_rgb(filename, outfile);
break;
case Displace:
foo = essai_displacement(filename, outfile);
break;
default:
fprintf(stderr, "%s : bad command\n", command);
exit(1);