commit du soir, espoir
This commit is contained in:
41
lib/t.c
41
lib/t.c
@@ -72,56 +72,65 @@ 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;
|
||||
int foo, idx, opt;
|
||||
float coef;
|
||||
FloatImg dessin, noise, result;
|
||||
char outname[100];
|
||||
int gray = 0;
|
||||
int nb_img = 42;
|
||||
|
||||
verbosity = 1;
|
||||
while ((opt = getopt(argc, argv, "gn:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': gray++; break;
|
||||
case 'n': nb_img=atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbosity) fimg_print_version(0);
|
||||
|
||||
fimg_print_version(1);
|
||||
|
||||
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s1.png", &dessin);
|
||||
if (foo) {
|
||||
fprintf(stderr, "s1 load err %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
fimg_describe(&dessin, "s1 dessin");
|
||||
fimg_to_gray(&dessin);
|
||||
if (verbosity) fimg_describe(&dessin, "s1 dessin");
|
||||
if (gray) fimg_to_gray(&dessin);
|
||||
|
||||
foo = fimg_create_from_png("/home/tth/TMP/floatimg/s2.png", &noise);
|
||||
if (foo) {
|
||||
fprintf(stderr, "s2 load err %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
fimg_describe(&noise, "s2 noise");
|
||||
if (verbosity) fimg_describe(&noise, "s2 noise");
|
||||
fimg_mul_cste(&noise, 0.50);
|
||||
if (gray) fimg_to_gray(&noise);
|
||||
|
||||
foo = fimg_create(&result, W, H, 3);
|
||||
if (verbosity) fimg_describe(&result, "d result");
|
||||
|
||||
#define NBRE 20
|
||||
|
||||
for (idx=0; idx<NBRE; idx++) {
|
||||
|
||||
coef = (float)idx / (float)NBRE;
|
||||
coef = (0.5-0.5*cos( 3.141592654*coef));
|
||||
fprintf(stderr, "running for %d picz\n", nb_img);
|
||||
|
||||
for (idx=0; idx<nb_img; idx++) {
|
||||
|
||||
coef = (float)idx / (float)nb_img;
|
||||
// coef = (0.5-0.5*cos(4*3.141592654*coef));
|
||||
|
||||
foo = fimg_interpolate(&dessin, &noise, &result, coef);
|
||||
printf("%6d %9.6f\n", idx, coef);
|
||||
// fimg_to_gray(&result);
|
||||
printf("%6d %9.6f\n", idx, coef);
|
||||
|
||||
sprintf(outname, "/home/tth/TMP/floatimg/%05d.pnm", idx);
|
||||
foo = fimg_save_as_pnm(&result, outname, 0);
|
||||
}
|
||||
// essai_2gray(&result, "gray.pnm");
|
||||
|
||||
/* yes, we can cleanup after work */
|
||||
fimg_destroy(&dessin), fimg_destroy(&noise), fimg_destroy(&result);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user