starting interpolate funcs

This commit is contained in:
2019-09-09 16:02:44 +02:00
parent f4001a1e13
commit 2f3a8870c4
4 changed files with 95 additions and 15 deletions

54
lib/t.c
View File

@@ -1,3 +1,8 @@
/*
* programme de test pour
* les fonctions de base.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -62,25 +67,48 @@ fimg_destroy(&gray);
return 0;
}
/* ---------------------------------------------------------------- */
#define W 2048
#define H 2048
int main(int argc, char *argv[])
{
int foo;
FloatImg dessin, noise, result;
verbosity = 1;
fimg_print_version(1);
/****
foo = fimg_create(&dessin, W, H, 3);
petit_dessin(&dessin);
foo = fimg_create(&noise, W, H, 3);
fimg_drand48(&noise, 0.1);
****/
/* ---------------------------------------------------------------- */
#define W 320
#define H 240
int main(int argc, char *argv[])
{
int foo, idx;
float coef;
FloatImg dessin, noise, result;
char outname[100];
verbosity = 1;
fimg_print_version(1);
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s2.png", &dessin);
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s1.png", &noise);
foo = fimg_create(&result, W, H, 3);
foo = fimg_mul(&dessin, &noise, &result);
essai_2gray(&result, "gray.pnm");
#define NBRE 42
for (idx=0; idx<NBRE; idx++) {
coef = (float)idx / (float)NBRE;
coef = (0.5-0.5*cos( 3.141592654*coef));
foo = fimg_interpolate(&dessin, &noise, &result, coef);
printf("%6d %9.6f\n", idx, coef);
fimg_to_gray(&result);
sprintf(outname, "/home/tth/TMP/floatimg/%05d.pnm", idx);
foo = fimg_save_as_pnm(&result, outname, 0);
}
// essai_2gray(&result, "gray.pnm");
fimg_destroy(&dessin), fimg_destroy(&noise), fimg_destroy(&result);