still tweaking...

This commit is contained in:
phyto
2020-12-07 22:02:08 +01:00
parent 8668e15d3e
commit ae7fdd49bc
3 changed files with 22 additions and 7 deletions

View File

@@ -31,7 +31,21 @@ if (foo) {
return 0;
}
/* -------------------------------------------------------------- */
int get_float_metric_a_from_file(char *fname, float *where)
int get_float_metric_b(FloatImg *pimg, float *where)
{
int idx, size;
double adder;
adder = 0.0;
size = pimg->width * pimg->height;
for (idx=20; idx < size; idx+=42) {
adder += (double)pimg->R[idx];
}
*where = (float)adder;
return 0;
}
/* -------------------------------------------------------------- */
int get_float_metric_from_file(char *fname, float *where, int mode)
{
FloatImg image;
int foo;
@@ -43,10 +57,9 @@ if (foo) {
return foo;
}
fval = -1.0; /* sensible default value */
foo = get_float_metric_a(&image, &fval);
foo = get_float_metric_b(&image, &fval);
*where = fval;
// fprintf(stderr, "metric of '%s' = %f\n", fname, fval);
fimg_destroy(&image);
return 0;