Browse Source

simplified test prog

master
tth 3 years ago
parent
commit
20d122890b
  1. 43
      lib/t.c

43
lib/t.c

@ -35,20 +35,39 @@ return -1; @@ -35,20 +35,39 @@ return -1;
int essai_2gray(FloatImg *picz, char *outname)
{
int foo;
FloatImg gray;
fprintf(stderr, ">>> %s ( %p '%s' )\n", __func__, picz, outname);
foo = fimg_create(&gray, picz->width, picz->height, FIMG_TYPE_GRAY);
if (foo) {
fprintf(stderr, "%s : err %d on fimg create\n", __func__, foo);
exit(1);
}
foo = fimg_mk_gray_from(picz, &gray, 0);
if (foo) {
fprintf(stderr, "%s : err %d on fimg mk_gray_from\n", __func__, foo);
exit(1);
}
return -1;
foo = fimg_save_as_pnm(&gray, outname, 0);
if (foo) {
fprintf(stderr, "%s : err %d on save_as_pnm\n", __func__, foo);
exit(1);
}
fimg_destroy(&gray);
return 0;
}
/* ---------------------------------------------------------------- */
#define W 4000
#define H 3000
#define W 2048
#define H 2048
int main(int argc, char *argv[])
{
int foo;
FloatImg dessin, noise, result;
int datas[3];
verbosity = 1;
@ -56,24 +75,14 @@ fimg_print_version(1); @@ -56,24 +75,14 @@ fimg_print_version(1);
foo = fimg_create(&dessin, W, H, 3);
petit_dessin(&dessin);
fimg_save_as_pnm(&dessin, "dessin.pnm", 0);
foo = fimg_create(&noise, W, H, 3);
fimg_drand48(&noise, 1.0);
fimg_save_as_pnm(&noise, "noise.pnm", 0);
fimg_drand48(&noise, 0.1);
foo = fimg_create(&result, W, H, 3);
foo = fimg_add(&dessin, &noise, &result);
fimg_save_as_pnm(&result, "r_add.pnm", 0);
foo = fimg_mul(&dessin, &noise, &result);
essai_2gray(&result, "gray.pnm");
foo = fimg_sub(&dessin, &noise, &result);
fimg_save_as_pnm(&result, "r_sub.pnm", 0);
foo = fimg_mul(&dessin, &noise, &result);
fimg_save_as_pnm(&result, "r_mul.pnm", 0);
fimg_destroy(&dessin), fimg_destroy(&noise), fimg_destroy(&result);
return 0;
}

Loading…
Cancel
Save