importing the Interpolator for R325 project

This commit is contained in:
le vieux
2020-11-09 20:27:57 +01:00
parent 6b424ea72a
commit 538a8ffa82
6 changed files with 154 additions and 13 deletions

View File

@@ -56,6 +56,7 @@ int to_gray = 0;
char *output_file = "out.fimg";
FloatImg accu, temp;
int src_loaded = 0;
float vals[6];
g_width = g_height = 0;
@@ -74,11 +75,9 @@ fprintf(stderr, "argc = %d, optind = %d\n", argc, optind);
#endif
for (idx=optind; idx<argc; idx++) {
#if DEBUG_LEVEL
fprintf(stderr, "%5d %s\n", idx, argv[idx]);
#endif
foo = testfile(argv[idx]);
if (foo) {
fprintf(stderr, "testfile %s -> %d\n", argv[idx],foo);
@@ -98,12 +97,9 @@ for (idx=optind; idx<argc; idx++) {
}
fimg_add_2(&temp, &accu);
}
}
if (to_gray) {
foo = fimg_desaturate(&accu, &accu, 0);
if (foo) {
fprintf(stderr, "desaturate: error %d\n", foo);
@@ -116,6 +112,21 @@ if (foo) {
exit(1);
}
if (verbosity) {
/* show some numbers about resultant picture */
foo = fimg_get_minmax_rgb(&accu, vals);
if (foo) {
fprintf(stderr, "err %d on fimg_get_minmax_rgb\n", foo);
return foo;
}
printf("Rmin %12.4g Rmax %12.4g delta %12g\n",
vals[0], vals[1], vals[1]-vals[0]);
printf("Gmin %12.4g Gmax %12.4g %12g\n",
vals[2], vals[3], vals[3]-vals[2]);
printf("Bmin %12.4g Bmax %12.4g %12g\n",
vals[4], vals[5], vals[5]-vals[4]);
}
return 0;
}
/* --------------------------------------------------------------------- */

View File

@@ -1,5 +1,10 @@
/*
* PNG ---> FIMG
*
* Attention : certains fichiers PNG ne passent pas cette
* moulinette, mais le bug est dans la bibliotheque de
* fonctions 'libpnglite'. Une solution de remplacement
* devrait etre a l'etude un de ces jours...
*/
#include <stdio.h>
@@ -17,6 +22,10 @@ int main(int argc, char *argv[])
FloatImg fimg;
int foo;
/*
* pas de traitement des options ?
*/
if (3 != argc) {
fimg_print_version(1);
fprintf(stderr, "usage:\n\t%s foo.png bar.fimg\n", argv[0]);
@@ -31,7 +40,7 @@ if (foo) {
exit(1);
}
fimg_describe(&fimg, argv[2]);
if (verbosity) fimg_describe(&fimg, argv[2]);
foo = fimg_dump_to_file(&fimg, argv[2], 0);
fprintf(stderr, "save as fimg -> %d\n", foo);