Compare commits

..

No commits in common. "3eed90c3e76363158d1f90db1e45cc294b0f6040" and "f63f918530955994b7dc3e2dd4cdb4c09f6a2153" have entirely different histories.

50 changed files with 104 additions and 358 deletions

View File

@ -122,7 +122,7 @@ int foo, idx, ipng, w, h, step;
int curpix; int curpix;
int iarray[3]; int iarray[3];
char *cptr, line[200]; char *cptr, line[200];
float coef; float coef, value;
double meanmetric; double meanmetric;
IdxValue *idx_values; /* gni? */ IdxValue *idx_values; /* gni? */
@ -175,6 +175,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
fprintf(stderr, "load %s from dump -> %d\n", cptr, foo); fprintf(stderr, "load %s from dump -> %d\n", cptr, foo);
continue; continue;
} }
value = idx_values[idx].value; /* WTF ? */
/* here was the input filter */ /* here was the input filter */
foo = filterstack_run(0, &B, 0); foo = filterstack_run(0, &B, 0);

14
LICENSE
View File

@ -1,14 +0,0 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -13,9 +13,6 @@ all: essai
essai: essai.c libfloatimg.a floatimg.h Makefile essai: essai.c libfloatimg.a floatimg.h Makefile
gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@ gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
install:
@echo "=== Use the 'install.sh' script ==="
#--------------------------------------------------------------- #---------------------------------------------------------------
TOTAR = *.[ch] Makefile *.sh *.md \ TOTAR = *.[ch] Makefile *.sh *.md \

View File

@ -38,18 +38,8 @@ apt install libv4l2-dev
apt install libcfitsio-dev apt install libcfitsio-dev
apt install libnetpbm-dev apt install libnetpbm-dev
``` ```
Bon, OK, je suis en train de changer de machine, et ça serait vraiment
cool d'avoir juste une ligne à c'n'p, donc voila :
```
apt install libtiff-dev libpnglite-dev liblo-dev libv4l2-dev \
libcfitsio-dev libnetpbm-dev
```
Il est probable que j'en oublie. Il est probable que j'en oublie.
Et ya Debian qui change des trucs, alors, ça marche plus, du Et ya Debian qui change des trucs, alors, ça marche plus
genre que c'est la deuxième fois que ça m'arrive.
``` ```
E: Unable to locate package libv4l2-dev E: Unable to locate package libv4l2-dev

View File

@ -1,29 +1,14 @@
/* /*
* floatimg.h * floatimg.h
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
* ugly code from tTh * ugly code from tTh
* http://la.buvette.org/photos/cumul/ * http://la.buvette.org/photos/cumul
* https://git.tetalab.org/tTh/FloatImg * https://git.tetalab.org/tTh/FloatImg
*/ */
#define FIMG_VERSION (197) #define FIMG_VERSION (187)
#define RELEASE_NAME ("noname") #define RELEASE_NAME ("noname")
/* /*
* in memory descriptor of a floating image * in memory descriptor
*/ */
#define MAGIC_FIMG 0x00F11F00 #define MAGIC_FIMG 0x00F11F00
typedef struct { typedef struct {
@ -43,11 +28,7 @@ typedef struct {
typedef struct { typedef struct {
char magic[8]; // this is not an asciiz ! char magic[8]; // this is not an asciiz !
int32_t w, h, t; int32_t w, h, t;
/*
* what about the packing ?
*/
} FimgFileHead; } FimgFileHead;
/* /*
* new 11 mars 2022, and a lot of iterations * new 11 mars 2022, and a lot of iterations
* around the concept of metadata for my work. * around the concept of metadata for my work.
@ -65,7 +46,7 @@ typedef struct {
} FimgMetaData; } FimgMetaData;
/* /*
* we MUST look at packing and endianess problems NOW * we MUST look at packing and endianess problems NOW
* and we can think about a fised size of this datablock * and we can thing about a fised size of this datablock
*/ */
@ -137,25 +118,21 @@ int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d); int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d); int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
/* ---------------------------------------------------- */
/* funcs/filtrage.c */ /* funcs/filtrage.c */
typedef struct { typedef struct {
float matrix[9]; float matrix[9];
float mult; float mult;
float offset; float offset;
} FimgFilter3x3; } FimgFilter3x3;
/*
* this module contains bugs...
*/
int fimg_killborders(FloatImg *img); int fimg_killborders(FloatImg *img);
int fimg_lissage_2x2(FloatImg *img); int fimg_lissage_2x2(FloatImg *img);
int fimg_show_filter(char *title, FimgFilter3x3 *filtr); int fimg_show_filter(char *title, FimgFilter3x3 *filtr);
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr); int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse);
/* ---------------------------------------------------- */ int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse);
/* module sfx0.c */ /* module sfx0.c */
int fimg_killcolors_a(FloatImg *fimg, float fval); int fimg_killcolors_a(FloatImg *fimg, float fval);

View File

@ -8,19 +8,13 @@ __Attention__ : la bibliothèque `pnglite`actuellement utilisée pour lire
les fichiers PNG n'accepte que **certains** types de fichiers. les fichiers PNG n'accepte que **certains** types de fichiers.
Et en particulier, elle brotche sur ceux produits par ImageMagick ! Et en particulier, elle brotche sur ceux produits par ImageMagick !
## FITS
Un Format de fichier utilisé en astronomie.
https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node1.html
## DICOM ## DICOM
https://en.wikipedia.org/wiki/DICOM et ça semble bien compliqué :( https://en.wikipedia.org/wiki/DICOM et ça semble bien compliqué :(
## Contours ## Contours
Détecter des contours est une activité respectable. Mais difficile. Détecter des contours est une activité respectable.
## Exporter ## Exporter

View File

@ -15,7 +15,7 @@ extern int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */ /* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int flags) int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int notused)
{ {
float minmax[6], delta[3], baryc[3]; float minmax[6], delta[3], baryc[3];
float range, dist, rgb[3], dr, dg, db; float range, dist, rgb[3], dr, dg, db;
@ -26,8 +26,6 @@ fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__,
psrc, pdst, fval, notused); psrc, pdst, fval, notused);
#endif #endif
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
if (FIMG_TYPE_RGB != psrc->type) { if (FIMG_TYPE_RGB != psrc->type) {
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
return -7; return -7;

View File

@ -23,14 +23,15 @@ extern int verbosity;
/* A lot of strange and usefull parenthesis */ /* A lot of strange and usefull parenthesis */
/* == ---------------------------------------------------- == */ /* == ---------------------------------------------------- == */
#if DEBUG_LEVEL
static float compute_z_value(float r, float g, float b) static float compute_z_value(float r, float g, float b)
{ {
double dval; double dval;
return 42.0; return 42.0;
} }
#endif
/* == ---------------------------------------------------- == */ /* == ---------------------------------------------------- == */
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k) int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k)
@ -44,9 +45,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
psrc, pdst, k); psrc, pdst, k);
#endif #endif
if (k) { fprintf(stderr, "k=%d in %s\n", k, __func__); }
fimg_clear(pdst); fimg_clear(pdst);
w2 = psrc->width/2; h2 = psrc->height/2; w2 = psrc->width/2; h2 = psrc->height/2;
for (y=0; y<h2; y++) for (y=0; y<h2; y++)
@ -102,9 +102,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
psrc, pdst, k); psrc, pdst, k);
#endif #endif
if (k) { fprintf(stderr, "k=%d in %s\n", k, __func__); }
fimg_clear(pdst); fimg_clear(pdst);
w2 = psrc->width/2; h2 = psrc->height/2; w2 = psrc->width/2; h2 = psrc->height/2;
for (y=0; y<h2; y++) for (y=0; y<h2; y++)

View File

@ -17,12 +17,6 @@ int fimg_dither_0(FloatImg *psrc, FloatImg *pdst, int flags)
{ {
int x, y; int x, y;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, psrc, pdst, flags);
#endif
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
for (y=0; y<psrc->height; y++) { for (y=0; y<psrc->height; y++) {
for (x=0; x<psrc->width; x++) for (x=0; x<psrc->width; x++)

View File

@ -32,8 +32,6 @@ if (foo) {
return foo; return foo;
} }
fprintf(stderr, "vptr is %p vmax is %f\n", vptr, vmax);
dr = minmax[1] - minmax[0]; dr = minmax[1] - minmax[0];
dg = minmax[3] - minmax[2]; dg = minmax[3] - minmax[2];
db = minmax[5] - minmax[4]; db = minmax[5] - minmax[4];
@ -47,7 +45,7 @@ if ( (minmax[0]<0.0) || (minmax[2]<0.0) || (minmax[4]<0.0) ) {
return -4; return -4;
} }
fprintf(stderr, "deltas %12.4g %12.4g %12.4g\n", dr, dg, db); // printf("deltas %12.4g %12.4g %12.4g\n", dr, dg, db);
return 0; return 0;
} }

View File

@ -25,8 +25,6 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%X )\n", __func__,
pic, fname, flags); pic, fname, flags);
#endif #endif
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
filetype = format_from_extension(fname); filetype = format_from_extension(fname);
if (verbosity > 1) { if (verbosity > 1) {
fprintf(stderr, "file %s have type %d\n", fname, filetype); fprintf(stderr, "file %s have type %d\n", fname, filetype);

View File

@ -1,15 +1,11 @@
/* /*
* FloatImg library from tTh - really ugly code inside * FloatImg library from tTh - really ugly code inside
*
* F A L S E C O L O R S
* or fake colors ?
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <sys/time.h> #include <sys/time.h>
#include <math.h>
#include "../floatimg.h" #include "../floatimg.h"
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@ -17,67 +13,27 @@
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* TRUCS A VOIR
f(x,y) = (((y & x) * (y - x)) % ((21 & x) * (y | 8))) ^ (~((x & 7) | (x % x)))
*/
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* nouveau 18 mai 2022 */ /* nouveau 18 mai 2022 */
/* please explain the meaning of 'valf' parameter */
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf) int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf)
{ {
int x, y, offset; int x, y;
float r, g, b, gray, maxv;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__, fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__,
src, dst, k, valf); src, dst, k, valf);
#endif
if (k) {
fprintf(stderr, "%s : %d %f\n", __func__, k, valf);
}
/* check validity of parameters */
if (FIMG_TYPE_RGB != dst->type) {
fprintf(stderr, "in %s, picz at %p is not valid\n",
__func__, dst);
abort();
/* BLAM! */
}
maxv = fimg_get_plane_maxvalue(src, 'r');
fprintf(stderr, "%s: maxv of red plane = %f\n", __func__, maxv);
/* enter big loop */
offset = 0;
for (y=0; y<src->height; y++) { for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) { for (x=0; x<src->width; x++) {
gray = src->R[offset]; /***********************/
/* DO SOMETHING HERE ! */
/***********************/
if (gray < maxv/2.0) {
r = gray * 2.0;
g = 0.0;
}
else {
r = 0.0;
g = gray * 2.0;
}
b = fmodf(gray*8.0, maxv);
dst->R[offset] = r;
dst->G[offset] = g;
dst->B[offset] = b;
/* and GOTO next pixel */
offset++;
} }
} }
return 0; return -1;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -16,7 +16,7 @@ extern int verbosity;
int fimg_show_filter(char *title, FimgFilter3x3 *filtr) int fimg_show_filter(char *title, FimgFilter3x3 *filtr)
{ {
float *M; /* alias of filter matrix */ float *M; /* alias of filter matrix */
int idx; int foo, idx;
float sum, value; float sum, value;
if (title) fprintf(stderr, "--------- %s ---------\n", title); if (title) fprintf(stderr, "--------- %s ---------\n", title);
@ -34,7 +34,7 @@ fprintf(stderr, " mult %8.3f\n", filtr->mult);
fprintf(stderr, " offset %8.3f\n", filtr->offset); fprintf(stderr, " offset %8.3f\n", filtr->offset);
value = (sum * filtr->mult) + filtr->offset; value = (sum * filtr->mult) + filtr->offset;
fprintf(stderr, " value %8.3f ???\n", value); fprintf(stderr, " value %8.3f ???\n", sum);
return 0; return 0;
} }

View File

@ -17,12 +17,12 @@ extern int verbosity; /* must be declared around main() */
int fimg_save_plane_as_dicom(FloatImg *src, char *outname, int fimg_save_plane_as_dicom(FloatImg *src, char *outname,
char plane, int flags) char plane, int flags)
{ {
int foo;
float *planeptr; float *planeptr;
fprintf(stderr, ">>> %s ( %p %s %c %d )\n", __func__, src, outname, plane, flags); fprintf(stderr, ">>> %s ( %p %s %c %d )\n", __func__, src, outname, plane, flags);
planeptr = charplane2int(plane, src); /* please explain XXX */ planeptr = charplane2int(plane, src);
fprintf(stderr, "planeptr is %p\n", planeptr);
if (verbosity) { if (verbosity) {
fimg_describe(src, outname); fimg_describe(src, outname);

View File

@ -32,8 +32,6 @@ long naxes[2];
fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags); fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
#endif #endif
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
status = 0; status = 0;
switch (plane) { switch (plane) {

View File

@ -14,9 +14,9 @@
extern int verbosity; extern int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static void print_struct_pam(struct pam *ppam, char *text) static void print_struct_pam(struct pam *ppam, char *txt)
{ {
printf(" text %s\n", text);
printf(" size %d\n", ppam->size); printf(" size %d\n", ppam->size);
printf(" format %d\n", ppam->format); printf(" format %d\n", ppam->format);
@ -24,6 +24,7 @@ printf(" plainformat %d\n", ppam->plainformat);
printf(" width & height %d %d\n", ppam->width, ppam->height); printf(" width & height %d %d\n", ppam->width, ppam->height);
printf(" depth %d\n", ppam->depth); printf(" depth %d\n", ppam->depth);
printf(" maxval %lu\n", ppam->maxval); printf(" maxval %lu\n", ppam->maxval);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -23,9 +23,6 @@ int x, y, idx, foo;
char ligne[100]; char ligne[100];
double maximum, fk; double maximum, fk;
if (flags) fprintf(stderr, "in %s, flags are 0x%04x, must be 0\n",
__func__, flags);
/* bon, tout cela semble bien tortueux ! */ /* bon, tout cela semble bien tortueux ! */
if (FIMG_TYPE_RGB != src->type) { if (FIMG_TYPE_RGB != src->type) {

View File

@ -27,8 +27,6 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
src, dst, notused); src, dst, notused);
#endif #endif
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
/* no magic check here ? */ /* no magic check here ? */
if (dst->width || dst->height) { if (dst->width || dst->height) {
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst); fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
@ -67,8 +65,6 @@ int wd, hd;
int foo, x, y, x2, y2; int foo, x, y, x2, y2;
float ac; float ac;
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
if (dst->width || dst->height) { if (dst->width || dst->height) {
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst); fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
fimg_describe(dst, "destination halfsize 1"); fimg_describe(dst, "destination halfsize 1");
@ -112,6 +108,7 @@ return 0;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect) int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect)
{ {
int foo;
int xs, ys, xd, yd; int xs, ys, xd, yd;
int count; int count;
float rgb[3]; float rgb[3];
@ -152,8 +149,6 @@ fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__,
src, dst, notused); src, dst, notused);
#endif #endif
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
if (fimg_images_not_compatible(src, dst)) { if (fimg_images_not_compatible(src, dst)) {
fprintf(stderr, "bad karma in %s\n", __func__); fprintf(stderr, "bad karma in %s\n", __func__);
return -9; return -9;

View File

@ -85,7 +85,7 @@ float hh, ff, p, q, t;
long i; long i;
if(hsv[1] <= 0.0) { // < is bogus, just shuts up warnings if(hsv[1] <= 0.0) { // < is bogus, just shuts up warnings
rgb[0] = rgb[1] = rgb[2] = (hsv[2] * scale); rgb[0] = rgb[1] = rgb[2] = hsv[2];
return 0; return 0;
} }
@ -131,10 +131,7 @@ int fimg_essai_hsv(char *fname)
float colors[3], values[3], newcols[3]; float colors[3], values[3], newcols[3];
int foo, r, g, b; int foo, r, g, b;
fprintf(stderr, "%s NOT writing to %s\n", __func__, fname);
#define INC 16 #define INC 16
for (r=0; r<255; r+=INC) { for (r=0; r<255; r+=INC) {
for (g=0; g<255; g+=INC) { for (g=0; g<255; g+=INC) {
for (b=0; b<255; b+=INC) { for (b=0; b<255; b+=INC) {

View File

@ -20,10 +20,9 @@ static int check_boundaries(FloatImg *from, FloatImg *to, FimgArea51 *a51)
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, from, to, a51); fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, from, to, a51);
#endif
fimg_printdims("from", from); fimg_printdims("from", from);
fimg_printdims("to ", to); fimg_printdims("to ", to);
#endif
/* just a small molly-guard */ /* just a small molly-guard */
if ( (a51->w < 0) || (a51->h < 0) ) { if ( (a51->w < 0) || (a51->h < 0) ) {
@ -31,13 +30,13 @@ if ( (a51->w < 0) || (a51->h < 0) ) {
abort(); /* FY Bro ! */ abort(); /* FY Bro ! */
} }
return 0; return -1;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* XXX
static int move_pixels(FloatImg *from, FloatImg *to, static int move_pixels(FloatImg *from, FloatImg *to,
FimgArea51 *a51, int flags) FimgArea51 *a51, int flags)
{ {
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__, fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__,
from, to, a51, flags); from, to, a51, flags);
@ -45,7 +44,6 @@ fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__,
return -1; return -1;
} }
*/
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst, int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags) int xpos, int ypos, int flags)
@ -60,8 +58,6 @@ fprintf(stderr, ">>> %s ( %p %p %d %d 0x%04X\n", __func__, psrc, pdst,
xpos, ypos, flags); xpos, ypos, flags);
#endif #endif
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
if (verbosity > 1) { if (verbosity > 1) {
fimg_describe(psrc, "source"); fimg_describe(psrc, "source");
fimg_describe(pdst, "destination"); fimg_describe(pdst, "destination");
@ -71,10 +67,6 @@ if (verbosity > 1) {
area.x = xpos; area.y = ypos; area.x = xpos; area.y = ypos;
area.w = psrc->width; area.h = psrc->height; area.w = psrc->width; area.h = psrc->height;
foo = check_boundaries(psrc, pdst, &area); foo = check_boundaries(psrc, pdst, &area);
if (foo) {
fprintf(stderr, "Boudary error %d in %s:%d\n", foo, __func__, __LINE__);
return foo;
}
if ( (xpos < 0) || (xpos > pdst->width - psrc->width) || if ( (xpos < 0) || (xpos > pdst->width - psrc->width) ||
(ypos < 0) || (ypos > pdst->height - psrc->height) ) { (ypos < 0) || (ypos > pdst->height - psrc->height) ) {

View File

@ -20,12 +20,12 @@ int line, col;
int ir; int ir;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k); fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
src, dst, k);
#endif #endif
if (k) { fprintf(stderr, "in %s k was %d\n", __func__, k); }
fimg_clear(dst); fimg_clear(dst);
ir = 0; ir = 0;
for (line=0; line<src->height; line++) { for (line=0; line<src->height; line++) {

View File

@ -26,10 +26,6 @@ if (fimg->type != FIMG_TYPE_RGB) {
return -6; return -6;
} }
if (type) {
fprintf(stderr, "%s : %d %f\n", __func__, type, dval);
}
/* rampe de primaires dans le quart du haut */ /* rampe de primaires dans le quart du haut */
val = (float)dval; val = (float)dval;
for (x=0; x<fimg->width; x++) { for (x=0; x<fimg->width; x++) {

View File

@ -58,8 +58,8 @@ return 0;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* /*
* un essai dans la roulotte :) * un essai dans la roulotte :)
* 11 oct 2021 : premier jet, essai concluant, mais necessite * 11 oct 2021 : premier jet, essai concluant, mais nécessite
* du travail sur les rand() pour etre plus 'noisy' * du travail sur les rand() pour être plus 'noisy'
* *
*/ */
int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur) int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur)
@ -68,8 +68,6 @@ static int count = 0;
static int flag = 0; static int flag = 0;
int foo; int foo;
/* may be a mollyguard on 'largeur' parameter ? */
if (0==count) { if (0==count) {
if (flag) { if (flag) {
count = irand2(5, 10); count = irand2(5, 10);
@ -89,7 +87,7 @@ if (verbosity) {
fprintf(stderr, "%s: count=%d flag=%d\n", __func__, count, flag); fprintf(stderr, "%s: count=%d flag=%d\n", __func__, count, flag);
} }
foo = fimg_pixelize_h_0(psrc, pdst, flag ? largeur : 32); foo = fimg_pixelize_h_0(psrc, pdst, flag ? 8 : 32);
if (foo) { if (foo) {
fprintf(stderr, "PANIC in %s\n", __func__); fprintf(stderr, "PANIC in %s\n", __func__);
abort(); abort();
@ -99,4 +97,6 @@ count--; /* nice trick bro */
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -31,11 +31,13 @@ for (y=0; y<img->height; y++) {
for (x=0; x<img->width; x++) { for (x=0; x<img->width; x++) {
dx = ((double)x/(double)img->width) - 0.5000; dx = ((double)x/(double)img->width) - 0.5000;
rgb[0] = sin(dx*10 + time + dy) + 1.0; rgb[0] = sin(dx*10 + time) + 1.0;
rgb[1] = sin(dx*12 + time + dy) + 1.0; rgb[1] = sin(dx*12 + time) + 1.0;
rgb[2] = sin(dx*14 + time + dy) + 1.0; rgb[2] = sin(dx*14 + time) + 1.0;
fimg_put_rgb(img, x, y, rgb); fimg_put_rgb(img, x, y, rgb);
} }
} }
return 0; return 0;

View File

@ -28,8 +28,6 @@ int foo, szimg;
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused); fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
#endif #endif
if (notused) { fprintf(stderr, "%s notused != 0, WTF ?\n", __func__); }
if (FIMG_TYPE_RGB != psrc->type) { if (FIMG_TYPE_RGB != psrc->type) {
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
return -7; return -7;
@ -80,8 +78,6 @@ float rgb[3];
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused); fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
#endif #endif
if (notused) { fprintf(stderr, "%s notused != 0, WTF ?\n", __func__); }
if (FIMG_TYPE_RGB != psrc->type) { if (FIMG_TYPE_RGB != psrc->type) {
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type); fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
return -7; return -7;

View File

@ -25,8 +25,6 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
src, dst, notused); src, dst, notused);
#endif #endif
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
if (src->type != FIMG_TYPE_RGB) { if (src->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s: src type %d not valid\n", __func__, fprintf(stderr, "%s: src type %d not valid\n", __func__,
src->type); src->type);

View File

@ -26,7 +26,7 @@ if (FIMG_TYPE_RGB != fimg->type) {
nbpix = fimg->width * fimg->height; nbpix = fimg->width * fimg->height;
for (foo=0; foo<nbpix; foo++) { for (foo=0; foo<nbpix; foo++) {
if ((fimg->R[foo]+fval) > fimg->G[foo]) if (fimg->R[foo] > fimg->G[foo])
fimg->B[foo] = fimg->R[foo]; fimg->B[foo] = fimg->R[foo];
else else
fimg->B[foo] = fimg->G[foo]; fimg->B[foo] = fimg->G[foo];
@ -50,7 +50,7 @@ if (FIMG_TYPE_RGB != fimg->type) {
nbpix = fimg->width * fimg->height; nbpix = fimg->width * fimg->height;
for (foo=0; foo<nbpix; foo++) { for (foo=0; foo<nbpix; foo++) {
if ((fimg->R[foo]+fval) > fimg->B[foo]) if (fimg->R[foo] > fimg->B[foo])
fimg->G[foo] = fimg->R[foo]; fimg->G[foo] = fimg->R[foo];
else else
fimg->G[foo] = fimg->B[foo]; fimg->G[foo] = fimg->B[foo];

View File

@ -25,11 +25,6 @@ int foo, size;
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused); fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
#endif #endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
foo = fimg_get_minmax_rgb(pimg, mm); foo = fimg_get_minmax_rgb(pimg, mm);
mR = (mm[1] - mm[0]) / 2.0; mR = (mm[1] - mm[0]) / 2.0;
mG = (mm[3] - mm[2]) / 2.0; mG = (mm[3] - mm[2]) / 2.0;
@ -59,11 +54,6 @@ float mm[6], mRa, mGa, mBa, mRb, mGb, mBb;
float *fptr; float *fptr;
int foo, size; int foo, size;
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused); fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
#endif #endif

View File

@ -28,15 +28,9 @@ fprintf(stderr, ">>> %s ( %p %p %f 0x%04x )\n", __func__,
src, dst, kval, notused); src, dst, kval, notused);
#endif #endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
halfval = fimg_get_maxvalue(src) / 2.0; halfval = fimg_get_maxvalue(src) / 2.0;
if (verbosity > 1) { if (verbosity > 1) {
fprintf(stderr, "%s: kval=%f & halfval=%f\n", __func__, fprintf(stderr, "%s: halfval=%f\n", __func__, halfval);
kval, halfval);
} }
for (y=0; y<src->height; y++) { for (y=0; y<src->height; y++) {

View File

@ -25,11 +25,6 @@ float in[3], out[3];
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused); fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
#endif #endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
for (y=0; y<src->height; y++) { for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++) { for (x=0; x<src->width; x++) {
foo = fimg_get_rgb(src, x, y, in); foo = fimg_get_rgb(src, x, y, in);
@ -53,18 +48,13 @@ return 0;
int fimg_split_level(FloatImg *src, FloatImg *dst, int notused) int fimg_split_level(FloatImg *src, FloatImg *dst, int notused)
{ {
float means[4]; float means[4];
// float in[3]; float in[3];
int foo, idx, surface; int foo, idx, surface;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused); fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
#endif #endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
foo = fimg_meanvalues(src, means); foo = fimg_meanvalues(src, means);
if (foo) { if (foo) {
return -66; return -66;

View File

@ -30,14 +30,13 @@ fprintf(stderr, "\nEssais fausses couleurs (type %d) -> '%s'\n", type, dstfile);
foo = fimg_create(&src, W, H, FIMG_TYPE_RGB); foo = fimg_create(&src, W, H, FIMG_TYPE_RGB);
foo = fimg_hdeg_a(&src, 12e3); foo = fimg_hdeg_a(&src, 12e3);
// fimg_export_picture(&src, "debug.pnm", 0);
foo = fimg_clone(&src, &dst, 0); foo = fimg_clone(&src, &dst, 0);
foo = fimg_clear(&dst); foo = fimg_clear(&dst);
foo = fimg_falsecolors_0(&src, &dst, type, 3.141592654); foo = fimg_falsecolors_0(&src, &dst, type, 3.141592654);
fprintf(stderr, "false colors 0 --> %d\n", foo);
foo = fimg_export_picture(&dst, dstfile, 0); foo= fimg_export_picture(&dst, dstfile, 0);
fimg_destroy(&src); fimg_destroy(&dst); fimg_destroy(&src); fimg_destroy(&dst);
return -1; return -1;

View File

@ -120,11 +120,6 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused)
{ {
int x, y, w, h, foo; int x, y, w, h, foo;
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (verbosity) if (verbosity)
fprintf(stderr, "parsing %s\n", str); fprintf(stderr, "parsing %s\n", str);

View File

@ -21,15 +21,7 @@ int fimg_mk_gray_from(FloatImg *src, FloatImg *dst, int k)
float kr, kg, kb, kdiv; float kr, kg, kb, kdiv;
int nbb, foo; int nbb, foo;
if (k) { kr = kg = kb = 1.0; /* canonic random values */
/* some random funky values ... */
kr = 0.789; kg = 0.523; kb = 0.349;
}
else {
/* ... and canonic random values */
kr = kg = kb = 1.0;
}
kdiv = kr + kg + kb; kdiv = kr + kg + kb;
/* we must check the validity of our parameters */ /* we must check the validity of our parameters */
@ -67,10 +59,6 @@ int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused)
int foo, nbb; int foo, nbb;
/* we must check the validity of our parameters */ /* we must check the validity of our parameters */
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (FIMG_TYPE_RGB != src->type || FIMG_TYPE_RGB != dst->type) { if (FIMG_TYPE_RGB != src->type || FIMG_TYPE_RGB != dst->type) {
fprintf(stderr, "%s : bad image type\n", __func__); fprintf(stderr, "%s : bad image type\n", __func__);
return -18; return -18;

View File

@ -94,8 +94,8 @@ if (NULL == pmd) {
} }
else { else {
/* OK, get some funky metadatas */ /* OK, get some funky metadatas */
// fprintf(stderr, "%s get metadatas\n", __func__); fprintf(stderr, "OK %s get funky metadatas\n", __func__);
fprintf(stderr, "acqu fval=%f count=%d\n", pmd->fval, pmd->count); fprintf(stderr, "acquisition values %f %d\n", pmd->fval, pmd->count);
} }
fp = fopen(fname, "w"); fp = fopen(fname, "w");
@ -111,7 +111,7 @@ filehead.t = fimg->type;
/* XXX metadata */ /* XXX metadata */
if (NULL != pmd) { if (NULL != pmd) {
// fprintf(stderr, "ok, %s give an 'a' flag\n", __func__); fprintf(stderr, "ok, %s give an 'a' flag\n", __func__);
filehead.magic[4] = 'a'; filehead.magic[4] = 'a';
} }
@ -125,7 +125,7 @@ if (1 != foo) {
/* we have metadata, put them on tape */ /* we have metadata, put them on tape */
if (NULL != pmd) { if (NULL != pmd) {
// fprintf(stderr, ">>> %s write metadata %p\n", __func__, pmd); fprintf(stderr, ">>> %s write metadata %p\n", __func__, pmd);
foo = fwrite(pmd, sizeof(FimgMetaData), 1, fp); foo = fwrite(pmd, sizeof(FimgMetaData), 1, fp);
if (1 != foo) { if (1 != foo) {
perror(fname); perror(fname);
@ -296,7 +296,7 @@ fprintf(stderr, ">>> %-25s ( '%s' %p )\n", __func__, fname, head);
/* /*
* may be we can crash coredump here if the head * may be we can crash coredump here if the head
* descriptor from caller is not blank ? * descriptor from calleris not blank ?
*/ */
fp = fopen(fname, "r"); fp = fopen(fname, "r");
@ -328,8 +328,7 @@ if (foo) {
* Oh boy, we have to skeep the metadata chunck * Oh boy, we have to skeep the metadata chunck
*/ */
if ('a' == filehead.magic[4]) { if ('a' == filehead.magic[4]) {
if (verbosity) fprintf(stderr, "OMG %s metadata !!!\n", __func__);
{ fprintf(stderr, "%s: %s has metadata\n", __func__, fname); }
foo = fseek(fp, (long)sizeof(FimgMetaData), SEEK_CUR); foo = fseek(fp, (long)sizeof(FimgMetaData), SEEK_CUR);
if (foo) { if (foo) {
fprintf(stderr, "%s : shit hit the fan\n", __func__); fprintf(stderr, "%s : shit hit the fan\n", __func__);

View File

@ -303,11 +303,6 @@ int fimg_ajust_from_grab(FloatImg *fi, double maxima, int notused)
{ {
double coef; double coef;
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (fi->type != FIMG_TYPE_RGB) { if (fi->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : type %d invalide\n", fprintf(stderr, "%s : type %d invalide\n",
__func__, fi->type); __func__, fi->type);
@ -329,7 +324,6 @@ if (verbosity) {
fprintf(stderr, "image @ %p\n", fi); fprintf(stderr, "image @ %p\n", fi);
fprintf(stderr, "fval %f\n", fi->fval); fprintf(stderr, "fval %f\n", fi->fval);
fprintf(stderr, "count %d\n", fi->count); fprintf(stderr, "count %d\n", fi->count);
fprintf(stderr, "maxima %f\n", maxima);
fprintf(stderr, "coef %f\n", coef); fprintf(stderr, "coef %f\n", coef);
} }

View File

@ -23,14 +23,9 @@ int fimg_load_from_pnm(char *fname, FloatImg *head, int notused)
FILE *fp; FILE *fp;
int width, height, maxval; int width, height, maxval;
int foo, line, column; int foo, line, column;
unsigned char *buffline, *idxrd; unsigned char *buffline, *idxrd, dummychar;
float *Rptr, *Gptr, *Bptr; float *Rptr, *Gptr, *Bptr;
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (NULL==head) { if (NULL==head) {
fprintf(stderr, "%s : head ptr is %p\n", __func__, head); fprintf(stderr, "%s : head ptr is %p\n", __func__, head);
return -8; return -8;
@ -63,7 +58,6 @@ if (foo) {
} }
#if DEBUG_LEVEL #if DEBUG_LEVEL
unsigned char dummychar;
fread(&dummychar, 1, 1, fp); fread(&dummychar, 1, 1, fp);
fprintf(stderr, "%s : dummychar %xx\n", __func__, dummychar); fprintf(stderr, "%s : dummychar %xx\n", __func__, dummychar);
#else #else

View File

@ -24,8 +24,6 @@ double fimg_timer_set(int whot)
{ {
double current; double current;
if (whot) fprintf(stderr, "in %s whot is %d\n", __func__, whot);
current = dtime(); current = dtime();
#if DEBUG_LEVEL #if DEBUG_LEVEL
@ -38,9 +36,6 @@ return memory_time;
double fimg_timer_get(int whot) double fimg_timer_get(int whot)
{ {
double current; double current;
if (whot) fprintf(stderr, "in %s whot is %d\n", __func__, whot);
current = dtime(); current = dtime();
return current - memory_time; return current - memory_time;
} }

View File

@ -6,7 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include <sys/time.h> #include <sys/time.h>
#include <string.h> #include <string.h>
@ -15,9 +14,6 @@
extern int verbosity; /* must be declared around main() */ extern int verbosity; /* must be declared around main() */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/*
* specific function because magic field is NOT an asciiz !
*/
static void puts_magic_8(char *ptr, FILE *fp) static void puts_magic_8(char *ptr, FILE *fp)
{ {
int foo; int foo;
@ -41,13 +37,10 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
pmd, title, notused); pmd, title, notused);
#endif #endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (NULL != title) { if (NULL != title) {
fprintf(stderr, "==== metadate for %s\n", title); fprintf(stderr, "==== metadate for %s\n", title);
} }
if (verbosity) { if (verbosity) {
fprintf(stderr, "sizeof(metadata) = %ld\n", \ fprintf(stderr, "sizeof(metadata) = %ld\n", \
sizeof(FimgMetaData)); sizeof(FimgMetaData));
@ -56,10 +49,9 @@ if (verbosity) {
/* SHOW TIMESTAMP HERE */ /* SHOW TIMESTAMP HERE */
fprintf(stderr, "seconds sc. epoch = %ld\n", pmd->timestamp.tv_sec); fprintf(stderr, "seconds sc. epoch = %ld\n", pmd->timestamp.tv_sec);
fprintf(stderr, "date & time = %s", ctime(&pmd->timestamp.tv_sec));
doubletime = (double)pmd->timestamp.tv_sec + \ doubletime = (double)pmd->timestamp.tv_sec + \
(double)pmd->timestamp.tv_usec / 1e6; (double)pmd->timestamp.tv_usec / 1e6;
fprintf(stderr, "dtime of day = %12.3f\n", doubletime); fprintf(stderr, "dtime of day = %e\n", doubletime);
fprintf(stderr, "creator pid = %ld\n", pmd->cpid); fprintf(stderr, "creator pid = %ld\n", pmd->cpid);
fprintf(stderr, "float value = %.3f\n", pmd->fval); fprintf(stderr, "float value = %.3f\n", pmd->fval);
fprintf(stderr, "counter = %d\n", pmd->count); fprintf(stderr, "counter = %d\n", pmd->count);
@ -93,8 +85,8 @@ if (foo) {
} }
else { else {
if (verbosity > 1) { if (verbosity > 1) {
fprintf(stderr, "%s : set TimeOfDay to %12ld %8ld\n", \ fprintf(stderr, " set TimeOfDay to %12ld , %8ld\n", \
__func__, tvl.tv_sec, tvl.tv_usec); tvl.tv_sec, tvl.tv_usec);
} }
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval)); memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
} }

21
lib/t.c
View File

@ -22,7 +22,7 @@ int foo;
fprintf(stderr, "-------- %s ( %s ) --------\n", __func__, fname); fprintf(stderr, "-------- %s ( %s ) --------\n", __func__, fname);
foo = fimg_default_metadata(&Md, 0); foo = fimg_default_metadata(&Md);
// foo = fimg_show_metadata(&Md, "default from t.c", 0); // foo = fimg_show_metadata(&Md, "default from t.c", 0);
@ -33,11 +33,8 @@ if (foo) {
} }
foo = fimg_show_metadata(&Md, fname, 0); foo = fimg_show_metadata(&Md, fname, 0);
if (foo) {
fprintf(stderr, "%s: show metadata -> %d\n", __func__, foo); return -1;
return foo;
}
return 0;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int essai_save_plane(int wot) int essai_save_plane(int wot)
@ -103,8 +100,7 @@ if (foo) {
fprintf(stderr, "%s err create A %d\n", __func__, foo); fprintf(stderr, "%s err create A %d\n", __func__, foo);
return foo; return foo;
} }
if (k) fimg_hdeg_a(&A, KDEG); fimg_hdeg_a(&A, KDEG);
else fimg_vdeg_a(&A, KDEG);
foo = fimg_create(&B, WI, HI, FIMG_TYPE_RGB); foo = fimg_create(&B, WI, HI, FIMG_TYPE_RGB);
if (foo) { if (foo) {
@ -301,12 +297,6 @@ fimg_save_as_pnm(&copy, "cos_010.pnm", 0);
fimg_destroy(&dessin); fimg_destroy(&copy); fimg_destroy(&dessin); fimg_destroy(&copy);
return 0; return 0;
}
/* ---------------------------------------------------------------- */
void help_me_obiwan(void)
{
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -315,10 +305,9 @@ int foo, opt;
// char outname[100]; // char outname[100];
int gray = 0; int gray = 0;
while ((opt = getopt(argc, argv, "ghn:v")) != -1) { while ((opt = getopt(argc, argv, "gn:v")) != -1) {
switch(opt) { switch(opt) {
case 'g': gray++; break; case 'g': gray++; break;
case 'h': help_me_obiwan(); break;
case 'n': foo=atoi(optarg); break; case 'n': foo=atoi(optarg); break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
default: default:

View File

@ -21,11 +21,6 @@ int foo, x, y, idx;
fprintf(stderr, ">>> %s ( '%s' %s' )\n", __func__, srcname, dstname); fprintf(stderr, ">>> %s ( '%s' %s' )\n", __func__, srcname, dstname);
#endif #endif
if (notused) {
fprintf(stderr, "in %s, notused must be 0, was %d !\n",
__func__, notused);
}
foo = fimg_create_from_dump(dstname, &dst); foo = fimg_create_from_dump(dstname, &dst);
if (foo) fprintf(stderr, "create dst fimg from '%s' -> %d\n", dstname, foo); if (foo) fprintf(stderr, "create dst fimg from '%s' -> %d\n", dstname, foo);
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -43,7 +43,7 @@ puts("\t-v\tincrease verbosity");
puts("\t-o\tname of output file"); puts("\t-o\tname of output file");
puts("\t-g\tconvert to gray level"); puts("\t-g\tconvert to gray level");
puts(""); puts("");
if (verbosity) { puts("Xperiment"); fimg_print_version(v); } if (verbosity) { puts("Xperiment"); fimg_print_version(1); }
exit(0); exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -65,7 +65,7 @@ g_width = g_height = 0;
while ((opt = getopt(argc, argv, "gho:vx")) != -1) { while ((opt = getopt(argc, argv, "gho:vx")) != -1) {
switch(opt) { switch(opt) {
case 'g': to_gray = 1; break; case 'g': to_gray = 1; break;
case 'h': help(1); break; case 'h': help(0); break;
case 'o': output_file = optarg; break; case 'o': output_file = optarg; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'x': experiment++; break; case 'x': experiment++; break;

View File

@ -39,13 +39,12 @@ static void help(int k)
{ {
puts("export to FITS format"); puts("export to FITS format");
puts("\t-p select colorplane : R, G, B"); puts("\t-p select colorplane : R, G, B");
fimg_print_version(k);
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int opt; int foo, opt;
int plane = '?'; int plane = '?';
while ((opt = getopt(argc, argv, "p:hv")) != -1) { while ((opt = getopt(argc, argv, "p:hv")) != -1) {

View File

@ -64,7 +64,7 @@ puts("usage:\n\tfimg2png [options] foo.fimg bar.png");
puts("options:"); puts("options:");
puts("\t-g\tconvert to gray"); puts("\t-g\tconvert to gray");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
if (verbosity) fimg_print_version(k); if (verbosity) fimg_print_version(1);
exit(0); exit(0);
} }

View File

@ -25,10 +25,6 @@ fprintf(stderr, ">>> %25s ( %p '%s' %d )\n", __func__,
src, fname, flags); src, fname, flags);
#endif #endif
if (0 != flags) {
fprintf(stderr, "bad flags in %s\n", __func__);
}
fp = NULL; /* molly guard */ fp = NULL; /* molly guard */
if (strcmp("-", fname)) { /* real file */ if (strcmp("-", fname)) { /* real file */
fprintf(stderr, "real file '%s'\n", fname); fprintf(stderr, "real file '%s'\n", fname);
@ -146,7 +142,7 @@ puts("\t-n 3.14\t\tnormalize picture");
puts("\t-s N\t\tsteps on x & y"); puts("\t-s N\t\tsteps on x & y");
if (verbosity) { if (verbosity) {
printf("*** compiled: %s at %s\n", __DATE__, __TIME__); printf("*** compiled: %s at %s\n", __DATE__, __TIME__);
fimg_print_version(k); fimg_print_version(1);
} }
exit(0); exit(0);
} }
@ -157,11 +153,11 @@ int main(int argc, char *argv[])
int foo, opt; int foo, opt;
int steps = 1; int steps = 1;
float norm_val = 222.0; /* < 0 : don't normalize */ float norm_val = 222.0; /* < 0 : don't normalize */
// char separator = ' '; char separator = ' ';
while ((opt = getopt(argc, argv, "f:hn:s:v")) != -1) { while ((opt = getopt(argc, argv, "f:hn:s:v")) != -1) {
switch(opt) { switch(opt) {
// case 'f': separator = optarg[0]; break; case 'f': separator = optarg[0]; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'h': help(1); exit(1); case 'h': help(1); exit(1);
case 's': steps = atoi(optarg); break; case 's': steps = atoi(optarg); break;

View File

@ -65,7 +65,7 @@ puts("usage:\n\tfimg2tiff [options] foo.fimg bar.tiff");
puts("options:"); puts("options:");
// puts("\t-g\tconvert to gray"); // puts("\t-g\tconvert to gray");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
if (verbosity) fimg_print_version(k); if (verbosity) fimg_print_version(1);
exit(0); exit(0);
} }

View File

@ -28,7 +28,7 @@ enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm, Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm,
Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul, Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R, Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
Fx_absolute, Fx_clamp, Fx_fakol0 }; Fx_absolute, Fx_clamp, Fx_shiftZ };
Fx fx_list[] = { Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 }, { "cos01", Fx_cos01, 0, 1 },
@ -52,7 +52,7 @@ Fx fx_list[] = {
{ "hilightr", Fx_hilight_R, 0, 1 }, { "hilightr", Fx_hilight_R, 0, 1 },
{ "abs", Fx_absolute, 0, 1 }, { "abs", Fx_absolute, 0, 1 },
{ "clamp", Fx_clamp, 0, 1 }, { "clamp", Fx_clamp, 0, 1 },
{ "fakol0", Fx_fakol0, 0, 1 }, { "shiftzero", Fx_shiftZ, 0, 1 },
{ NULL, 0, 0, 0 } { NULL, 0, 0, 0 }
}; };
@ -171,11 +171,6 @@ else {
action = fx_list[fxidx].id; action = fx_list[fxidx].id;
if (verbosity > 1) {
fprintf(stderr, "%s: fxidx=%d action=%d\n", __func__,
fxidx, action);
}
switch (action) { switch (action) {
case Fx_cos01: case Fx_cos01:
fimg_cos_01(&src, &dest, maxval); break; fimg_cos_01(&src, &dest, maxval); break;
@ -189,6 +184,7 @@ switch (action) {
case Fx_gray0: /* new 2020 01 10 */ case Fx_gray0: /* new 2020 01 10 */
fimg_to_gray(&src); fimg_copy_data(&src, &dest); fimg_to_gray(&src); fimg_copy_data(&src, &dest);
break; break;
case Fx_xper: case Fx_xper:
do_experiment(&src, &dest, maxval); break; do_experiment(&src, &dest, maxval); break;
@ -209,6 +205,7 @@ switch (action) {
global_fvalue); global_fvalue);
foo = fimg_classif_trial(&src, &dest, global_fvalue, 0); foo = fimg_classif_trial(&src, &dest, global_fvalue, 0);
break; break;
case Fx_desat: case Fx_desat:
fimg_copy_data(&src, &dest); fimg_copy_data(&src, &dest);
foo = fimg_mix_rgb_gray(&dest, global_fvalue); foo = fimg_mix_rgb_gray(&dest, global_fvalue);
@ -219,12 +216,9 @@ switch (action) {
case Fx_shift0: case Fx_shift0:
// fprintf(stderr, "Krkrk %d\n", action); // fprintf(stderr, "Krkrk %d\n", action);
foo = fimg_auto_shift_to_zero(&src, &dest); foo = fimg_auto_shift_to_zero(&src, &dest);
if (foo) {
fprintf(stderr, "*** shiftzero -> %d\n", foo);
}
break; break;
case Fx_trimul: case Fx_trimul:
// fprintf(stderr, "trimul %d\n", action); fprintf(stderr, "trimul %d\n", action);
foo = fimg_sfx_triplemul(&src, &dest, 0); foo = fimg_sfx_triplemul(&src, &dest, 0);
break; break;
case Fx_ctr2x2: case Fx_ctr2x2:
@ -254,11 +248,11 @@ switch (action) {
if (foo > 0) foo = 0; if (foo > 0) foo = 0;
break; break;
case Fx_fakol0: case Fx_shiftZ:
/***********************/ foo = fimg_auto_shift_to_zero(&src, &dest);
/* DO SOMETHING HERE ! */ if (foo) {
/***********************/ fprintf(stderr, "*** shiftzero -> %d\n", foo);
foo = fimg_falsecolors_0(&src, &dest, 0, 1.0); }
break; break;
default: default:
@ -315,10 +309,6 @@ if (3 > argc-optind) {
} }
if (verbosity>1) fprintf(stderr, "*** fimgfx *** %s %s\n", __DATE__, __TIME__); if (verbosity>1) fprintf(stderr, "*** fimgfx *** %s %s\n", __DATE__, __TIME__);
if (verbosity>2) {
for (foo=0; foo<argc; foo++)
fprintf(stderr, "\t\t%5d\t%s\n", foo, argv[foo]);
}
operator = argv[optind]; operator = argv[optind];
action = lookup_fxidx(operator); action = lookup_fxidx(operator);

View File

@ -52,7 +52,6 @@ void help(int u)
puts("Usage:\n\tfimghalfsize [options] in.fimg out.fimg"); puts("Usage:\n\tfimghalfsize [options] in.fimg out.fimg");
puts("Options:"); puts("Options:");
puts("\t-g\tconvert output to gray"); puts("\t-g\tconvert output to gray");
fimg_print_version(u);
exit(0); exit(0);
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */

View File

@ -11,11 +11,10 @@
#include "../floatimg.h" #include "../floatimg.h"
/* --------------------------------------------------------------------- */
int verbosity; int verbosity;
enum comId { C_timestamp, C_daytime, C_count, C_fval, C_cpid, C_origin, /* --------------------------------------------------------------------- */
enum comId { C_timestamp, C_count, C_fval, C_cpid, C_origin,
C_idcam, C_all }; C_idcam, C_all };
typedef struct { typedef struct {
@ -25,7 +24,6 @@ typedef struct {
Cmd Cmd_list[] = { Cmd Cmd_list[] = {
{ "timestamp", C_timestamp }, { "timestamp", C_timestamp },
{ "daytime", C_daytime },
{ "cpid", C_cpid }, { "cpid", C_cpid },
{ "count", C_count }, { "count", C_count },
{ "fval", C_fval }, { "fval", C_fval },
@ -76,8 +74,6 @@ action = lookup_cmd(command);
switch(action) { switch(action) {
case C_timestamp: case C_timestamp:
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break; printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
case C_daytime:
printf("%s\n", ctime(&metadata.timestamp.tv_sec)); break;
case C_count: case C_count:
printf("count %d\n", metadata.count); break; printf("count %d\n", metadata.count); break;
case C_fval: case C_fval:
@ -91,7 +87,7 @@ switch(action) {
case C_all: case C_all:
fimg_show_metadata(&metadata, fname, 0); break; fimg_show_metadata(&metadata, fname, 0); break;
default: default:
fprintf(stderr, "%s WTF?\n", __func__); exit(1); fprintf(stderr, "WTF?\n"); exit(1);
} }
return 0; return 0;
@ -108,6 +104,7 @@ exit(0);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo, opt, nbargs; int foo, opt, nbargs;
char *fname;
while ((opt = getopt(argc, argv, "hv")) != -1) { while ((opt = getopt(argc, argv, "hv")) != -1) {
switch(opt) { switch(opt) {

View File

@ -70,7 +70,7 @@ puts("options:");
printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue); printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue);
puts("\t-v\t\tincrease verbosity"); puts("\t-v\t\tincrease verbosity");
pr_opcodes(); pr_opcodes();
if (verbosity) fimg_print_version(lj); if (verbosity) fimg_print_version(1);
exit(0); exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -325,11 +325,12 @@ for (i = 0; i < nbre_capt; i++) {
out_name); out_name);
#endif #endif
if (nbre_capt > 1 && period > 0.0001) { if (nbre_capt > 1 && period > 0.001) {
/* suspend execution for /* suspend execution for
microsecond intervals */ microsecond intervals */
usleep((int)(period*1E6)); usleep((int)(period*1E6));
} }
xioctl(fd, VIDIOC_QBUF, &buf); xioctl(fd, VIDIOC_QBUF, &buf);
} }
@ -377,10 +378,6 @@ switch (contrast) {
break; break;
} }
/* XXX for the debug of metadata thing */
// fprintf(stderr, "after grab & contrast: fval %f count %d\n",
// cumul.fval, cumul.count);
/* XXX warning, new from coronahome 26 mars 2020 */ /* XXX warning, new from coronahome 26 mars 2020 */
to_save = &cumul; to_save = &cumul;
if (90 == rotfactor) { if (90 == rotfactor) {
@ -391,23 +388,17 @@ if (90 == rotfactor) {
foo = fimg_save_as_png(&tmpfimg, "rot90.png", 0); foo = fimg_save_as_png(&tmpfimg, "rot90.png", 0);
} }
to_save = &tmpfimg; to_save = &tmpfimg;
/*
* CRITICAL : we have to restore those values !
*/
to_save->fval = cumul.fval;
to_save->count = cumul.count;
} }
foo = format_from_extension(outfile); foo = format_from_extension(outfile);
switch (foo) { switch (foo) {
case FILE_TYPE_FIMG: case FILE_TYPE_FIMG:
if (add_metadata) {
fimg_default_metadata(&metadata, 51); fimg_default_metadata(&metadata, 51);
/* copy some values to mdstruct */ /* copy some values to mdstruct */
metadata.fval = to_save->fval; metadata.fval = to_save->fval;
metadata.count = to_save->count; metadata.count = to_save->count;
// fprintf(stderr, "-> save '%s' with metadata\n", if (add_metadata) {
// outfile); fprintf(stderr, ">>> save %s with md\n", outfile);
foo = fimg_dumpmd_to_file(to_save, outfile, \ foo = fimg_dumpmd_to_file(to_save, outfile, \
&metadata, 0); &metadata, 0);
} }