still tweaking...
This commit is contained in:
parent
8668e15d3e
commit
ae7fdd49bc
@ -66,7 +66,7 @@ fprintf(stderr, "IdxValues array at %p\n", idxvalues);
|
||||
/* compute all the needed values */
|
||||
for (idx=0; idx<nombre; idx++) {
|
||||
filename = ptr_glob->gl_pathv[idx];
|
||||
foo = get_float_metric_a_from_file(filename, &metrique);
|
||||
foo = get_float_metric_from_file(filename, &metrique, method);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d get metric of '%s'\n", __func__,
|
||||
foo, filename);
|
||||
@ -80,7 +80,7 @@ for (idx=0; idx<nombre; idx++) {
|
||||
|
||||
if (method) {
|
||||
/* and now, we can massage all our datas */
|
||||
fprintf(stderr, "sorting %d ...\n", method);
|
||||
// fprintf(stderr, "sorting %d ...\n", method);
|
||||
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ if (verbosity > 1) {
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -140,6 +140,8 @@ w = iarray[0], h = iarray[1];
|
||||
fprintf(stderr, "first image size : %dx%d\n", w, h);
|
||||
|
||||
fimg_create(&A, w, h, 3); pFirst = &A;
|
||||
fimg_vdeg_a(&A, idx_values[0].value);
|
||||
|
||||
fimg_create(&B, w, h, 3); pSecond = &B;
|
||||
fimg_create(&Out, w, h, 3);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -7,6 +7,6 @@
|
||||
/* first experiments */
|
||||
|
||||
int get_float_metric_a(FloatImg *pimg, float *where);
|
||||
int get_float_metric_a_from_file(char *imgname, float *where);
|
||||
int get_float_metric_from_file(char *imgname, float *where, int mode);
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user