more experiments

This commit is contained in:
2021-01-03 15:21:38 +01:00
parent 87c681ac70
commit 1d6f0e8b4e
9 changed files with 114 additions and 14 deletions

View File

@@ -12,6 +12,7 @@
#include "../floatimg.h"
#include "fonctions.h"
#include "metriques.h"
#include "sfx.h"
/* -------------------------------------------------------------- */
@@ -20,12 +21,50 @@
extern int verbosity;
/* -------------------------------------------------------------- */
/* nouveau du 27 decembre 2020, un soir de grand froid... */
/* nouveau du premier dimanche de 2020 'nextgen' */
static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
{
int x, y, off;
for (y=pos[1]; y<pos[1]+pos[3]; y++) {
for (x=pos[0]; x<pos[0]+pos[2]; x++) {
off = (y*pimg->width) + x;
pimg->R[off] = fvals[0];
}
}
return 0;
}
int trinitron(FloatImg *pimg, int notused)
{
int x, y, coo[4], foo;
float vals[3];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
#endif
#define STP 16 /* stepd for x & y axex */
coo[2] = coo[3] = STP;
for (y=0; y<pimg->height; y+=STP) {
coo[1] = y;
for (x=0; x<pimg->width; x+=STP) {
coo[0] = x;
foo = stat_zone(pimg, coo, vals);
if (foo) abort();
/* next step : plot the datas */
pixel_trinitron(pimg, coo, vals);
}
}
#undef STP
return 0;
}
/* -------------------------------------------------------------- */
/* nouveau du 27 decembre 2020, un soir de grand froid... */
int octotree_classif(FloatImg *pimg, float kdist, int notused)
{
int foo;
float mm[6], means[4], delta[3];
float mm[6], delta[3];
float r, g, b, kr, kg, kb, dp, trig;
int idx, sz, n8, count;
typedef struct {
@@ -38,16 +77,6 @@ fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__,
pimg, kdist, notused);
#endif
#if 0
foo = fimg_meanvalues(pimg, means);
if (foo) {
fprintf(stderr, "oups %d in meanvalues\n", foo);
return foo;
}
fprintf(stderr, "means: %11f %11f %11f\n",
means[0], means[1], means[2]);
#endif
foo = fimg_get_minmax_rgb(pimg, mm);
if (foo) {
fprintf(stderr, "oups %d in get minmax\n", foo);