first semi-good run of the Interpolator
This commit is contained in:
@@ -3,22 +3,52 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "../floatimg.h"
|
||||
#include "metriques.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
int get_float_metric(FloatImg *pimg, float *where, int whot)
|
||||
/*
|
||||
* premier essai...
|
||||
*/
|
||||
int get_float_metric(FloatImg *pimg, float *where)
|
||||
{
|
||||
float means[4];
|
||||
int foo;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, pimg, where, whot);
|
||||
#endif
|
||||
|
||||
*where = 0;
|
||||
|
||||
return -1;
|
||||
foo = fimg_meanvalues(pimg, means);
|
||||
if (foo) {
|
||||
fprintf(stderr, "fatal error in %s\n", __func__);
|
||||
exit(1);
|
||||
}
|
||||
*where = means[0] + means[1] + means[2];
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
int get_float_metric_from_file(char *fname, float *where)
|
||||
{
|
||||
FloatImg image;
|
||||
int foo;
|
||||
float fval;
|
||||
|
||||
foo = fimg_create_from_dump(fname, &image);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fname);
|
||||
return foo;
|
||||
}
|
||||
fval = -1.0; /* sensible default value */
|
||||
foo = get_float_metric(&image, &fval);
|
||||
*where = fval;
|
||||
|
||||
// fprintf(stderr, "metric of '%s' = %f\n", fname, fval);
|
||||
fimg_destroy(&image);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user