added a new function : fimg_rotate_90, need more tests

This commit is contained in:
tonton Th
2020-03-24 09:31:52 +01:00
parent 394b24bc92
commit e9a61bb96a
6 changed files with 125 additions and 11 deletions

View File

@@ -12,12 +12,43 @@ int verbosity;
float global_fvalue;
/* --------------------------------------------------------------------- */
int essai_rotate(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: err load '%s'\n", __func__, infile);
return foo;
}
}
else {
fprintf(stderr, "%s : NOT INPUT FILE, FUBAR\n", __func__);
abort();
}
fimg_save_as_png(&src, "test.png", 0);
foo = fimg_rotate_90(&src, &dst, 0);
fprintf(stderr, "rotate 90 -> %d\n", foo);
foo = fimg_save_as_png(&dst, "rotated90.png", 0);
foo = fimg_save_as_pnm(&dst, "rotated90.pnm", 0);
fimg_destroy(&src);
return -1;
}
/* --------------------------------------------------------------------- */
int essai_filtrage_3x3(char *infile)
{
FloatImg src, dst;
int foo, idx;
char buffer[100];
int foo; /// , idx;
// char buffer[100];
FimgFilter3x3 filter_a = {
@@ -54,7 +85,10 @@ else {
fimg_save_as_png(&src, "test.png", 0);
foo = fimg_clone(&src, &dst, 0);
if (foo) {
fprintf(stderr, "%s: err clone %p\n", __func__, &src);
return -44;
}
fimg_filter_3x3(&src, &dst, &filter_a);
foo = fimg_clamp_negativ(&dst);
if (foo) {
@@ -310,9 +344,9 @@ if (foo) {
}
*/
foo = essai_filtrage_3x3(filename);
foo = essai_rotate(filename);
if (foo) {
fprintf(stderr, "Filtre 3x3 ====> %d\n", foo);
fprintf(stderr, "Essai ====> %d\n", foo);
}
fprintf(stderr, "++++++++++++++ end of pid %d\n", getpid());