forked from tTh/FloatImg
big cleanup, word on metadata
This commit is contained in:
parent
aa2ced081a
commit
c7a51ec7a0
|
@ -122,7 +122,7 @@ int foo, idx, ipng, w, h, step;
|
|||
int curpix;
|
||||
int iarray[3];
|
||||
char *cptr, line[200];
|
||||
float coef, value;
|
||||
float coef;
|
||||
double meanmetric;
|
||||
IdxValue *idx_values; /* gni? */
|
||||
|
||||
|
@ -175,7 +175,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
|||
fprintf(stderr, "load %s from dump -> %d\n", cptr, foo);
|
||||
continue;
|
||||
}
|
||||
value = idx_values[idx].value; /* WTF ? */
|
||||
|
||||
/* here was the input filter */
|
||||
foo = filterstack_run(0, &B, 0);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
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.
|
||||
|
12
README.md
12
README.md
|
@ -38,8 +38,18 @@ apt install libv4l2-dev
|
|||
apt install libcfitsio-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.
|
||||
Et ya Debian qui change des trucs, alors, ça marche plus
|
||||
Et ya Debian qui change des trucs, alors, ça marche plus, du
|
||||
genre que c'est la deuxième fois que ça m'arrive.
|
||||
|
||||
```
|
||||
E: Unable to locate package libv4l2-dev
|
||||
|
|
37
floatimg.h
37
floatimg.h
|
@ -1,14 +1,29 @@
|
|||
/*
|
||||
* 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
|
||||
* http://la.buvette.org/photos/cumul
|
||||
* http://la.buvette.org/photos/cumul/
|
||||
* https://git.tetalab.org/tTh/FloatImg
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION (187)
|
||||
#define FIMG_VERSION (197)
|
||||
#define RELEASE_NAME ("noname")
|
||||
/*
|
||||
* in memory descriptor
|
||||
* in memory descriptor of a floating image
|
||||
*/
|
||||
#define MAGIC_FIMG 0x00F11F00
|
||||
typedef struct {
|
||||
|
@ -28,7 +43,11 @@ typedef struct {
|
|||
typedef struct {
|
||||
char magic[8]; // this is not an asciiz !
|
||||
int32_t w, h, t;
|
||||
/*
|
||||
* what about the packing ?
|
||||
*/
|
||||
} FimgFileHead;
|
||||
|
||||
/*
|
||||
* new 11 mars 2022, and a lot of iterations
|
||||
* around the concept of metadata for my work.
|
||||
|
@ -46,7 +65,7 @@ typedef struct {
|
|||
} FimgMetaData;
|
||||
/*
|
||||
* we MUST look at packing and endianess problems NOW
|
||||
* and we can thing about a fised size of this datablock
|
||||
* and we can think about a fised size of this datablock
|
||||
*/
|
||||
|
||||
|
||||
|
@ -118,22 +137,26 @@ int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d);
|
|||
int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||
int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||
|
||||
/* funcs/filtrage.c */
|
||||
|
||||
/* ---------------------------------------------------- */
|
||||
/* funcs/filtrage.c */
|
||||
typedef struct {
|
||||
float matrix[9];
|
||||
float mult;
|
||||
float offset;
|
||||
} FimgFilter3x3;
|
||||
|
||||
/*
|
||||
* this module contains bugs...
|
||||
*/
|
||||
int fimg_killborders(FloatImg *img);
|
||||
int fimg_lissage_2x2(FloatImg *img);
|
||||
int fimg_show_filter(char *title, FimgFilter3x3 *filtr);
|
||||
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
||||
|
||||
|
||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse);
|
||||
|
||||
/* ---------------------------------------------------- */
|
||||
|
||||
/* module sfx0.c */
|
||||
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
||||
int fimg_killcolors_b(FloatImg *fimg, float fval);
|
||||
|
|
|
@ -8,13 +8,19 @@ __Attention__ : la bibliothèque `pnglite`actuellement utilisée pour lire
|
|||
les fichiers PNG n'accepte que **certains** types de fichiers.
|
||||
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
|
||||
|
||||
https://en.wikipedia.org/wiki/DICOM et ça semble bien compliqué :(
|
||||
|
||||
## Contours
|
||||
|
||||
Détecter des contours est une activité respectable.
|
||||
Détecter des contours est une activité respectable. Mais difficile.
|
||||
|
||||
## Exporter
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ extern int verbosity;
|
|||
/* --------------------------------------------------------------------- */
|
||||
/* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */
|
||||
|
||||
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int notused)
|
||||
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int flags)
|
||||
{
|
||||
float minmax[6], delta[3], baryc[3];
|
||||
float range, dist, rgb[3], dr, dg, db;
|
||||
|
@ -26,6 +26,8 @@ fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__,
|
|||
psrc, pdst, fval, notused);
|
||||
#endif
|
||||
|
||||
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
|
||||
|
||||
if (FIMG_TYPE_RGB != psrc->type) {
|
||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
||||
return -7;
|
||||
|
|
|
@ -23,15 +23,14 @@ extern int verbosity;
|
|||
/* A lot of strange and usefull parenthesis */
|
||||
|
||||
/* == ---------------------------------------------------- == */
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
static float compute_z_value(float r, float g, float b)
|
||||
{
|
||||
double dval;
|
||||
|
||||
|
||||
|
||||
return 42.0;
|
||||
}
|
||||
#endif
|
||||
/* == ---------------------------------------------------- == */
|
||||
|
||||
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k)
|
||||
|
@ -45,8 +44,9 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
|||
psrc, pdst, k);
|
||||
#endif
|
||||
|
||||
fimg_clear(pdst);
|
||||
if (k) { fprintf(stderr, "k=%d in %s\n", k, __func__); }
|
||||
|
||||
fimg_clear(pdst);
|
||||
w2 = psrc->width/2; h2 = psrc->height/2;
|
||||
|
||||
for (y=0; y<h2; y++)
|
||||
|
@ -102,8 +102,9 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
|||
psrc, pdst, k);
|
||||
#endif
|
||||
|
||||
fimg_clear(pdst);
|
||||
if (k) { fprintf(stderr, "k=%d in %s\n", k, __func__); }
|
||||
|
||||
fimg_clear(pdst);
|
||||
w2 = psrc->width/2; h2 = psrc->height/2;
|
||||
|
||||
for (y=0; y<h2; y++)
|
||||
|
|
|
@ -17,6 +17,12 @@ int fimg_dither_0(FloatImg *psrc, FloatImg *pdst, int flags)
|
|||
{
|
||||
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 (x=0; x<psrc->width; x++)
|
||||
|
|
|
@ -32,6 +32,8 @@ if (foo) {
|
|||
return foo;
|
||||
}
|
||||
|
||||
fprintf(stderr, "vptr is %p vmax is %f\n", vptr, vmax);
|
||||
|
||||
dr = minmax[1] - minmax[0];
|
||||
dg = minmax[3] - minmax[2];
|
||||
db = minmax[5] - minmax[4];
|
||||
|
@ -45,7 +47,7 @@ if ( (minmax[0]<0.0) || (minmax[2]<0.0) || (minmax[4]<0.0) ) {
|
|||
return -4;
|
||||
}
|
||||
|
||||
// printf("deltas %12.4g %12.4g %12.4g\n", dr, dg, db);
|
||||
fprintf(stderr, "deltas %12.4g %12.4g %12.4g\n", dr, dg, db);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%X )\n", __func__,
|
|||
pic, fname, flags);
|
||||
#endif
|
||||
|
||||
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
|
||||
|
||||
filetype = format_from_extension(fname);
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "file %s have type %d\n", fname, filetype);
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
/*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <math.h>
|
||||
#include "../floatimg.h"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -13,27 +17,67 @@
|
|||
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 */
|
||||
/* please explain the meaning of 'valf' parameter */
|
||||
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf)
|
||||
{
|
||||
int x, y;
|
||||
int x, y, offset;
|
||||
float r, g, b, gray, maxv;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__,
|
||||
src, dst, k, valf);
|
||||
#endif
|
||||
|
||||
for (y=0; y<src->height, y++) {
|
||||
for (x=0; x<src->width, x++) {
|
||||
if (k) {
|
||||
fprintf(stderr, "%s : %d %f\n", __func__, k, valf);
|
||||
}
|
||||
|
||||
/***********************/
|
||||
/* DO SOMETHING HERE ! */
|
||||
/***********************/
|
||||
/* 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 (x=0; x<src->width; x++) {
|
||||
|
||||
gray = src->R[offset];
|
||||
|
||||
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 -1;
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
|
|
@ -16,7 +16,7 @@ extern int verbosity;
|
|||
int fimg_show_filter(char *title, FimgFilter3x3 *filtr)
|
||||
{
|
||||
float *M; /* alias of filter matrix */
|
||||
int foo, idx;
|
||||
int idx;
|
||||
float sum, value;
|
||||
|
||||
if (title) fprintf(stderr, "--------- %s ---------\n", title);
|
||||
|
|
|
@ -17,12 +17,12 @@ extern int verbosity; /* must be declared around main() */
|
|||
int fimg_save_plane_as_dicom(FloatImg *src, char *outname,
|
||||
char plane, int flags)
|
||||
{
|
||||
int foo;
|
||||
float *planeptr;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %p %s %c %d )\n", __func__, src, outname, plane, flags);
|
||||
|
||||
planeptr = charplane2int(plane, src);
|
||||
planeptr = charplane2int(plane, src); /* please explain XXX */
|
||||
fprintf(stderr, "planeptr is %p\n", planeptr);
|
||||
|
||||
if (verbosity) {
|
||||
fimg_describe(src, outname);
|
||||
|
|
|
@ -32,6 +32,8 @@ long naxes[2];
|
|||
fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__, src, outname, flags);
|
||||
#endif
|
||||
|
||||
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
|
||||
|
||||
status = 0;
|
||||
|
||||
switch (plane) {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
static void print_struct_pam(struct pam *ppam, char *txt)
|
||||
static void print_struct_pam(struct pam *ppam, char *text)
|
||||
{
|
||||
|
||||
printf(" text %s\n", text);
|
||||
printf(" size %d\n", ppam->size);
|
||||
|
||||
printf(" format %d\n", ppam->format);
|
||||
|
@ -24,7 +24,6 @@ printf(" plainformat %d\n", ppam->plainformat);
|
|||
printf(" width & height %d %d\n", ppam->width, ppam->height);
|
||||
printf(" depth %d\n", ppam->depth);
|
||||
printf(" maxval %lu\n", ppam->maxval);
|
||||
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ int x, y, idx, foo;
|
|||
char ligne[100];
|
||||
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 ! */
|
||||
|
||||
if (FIMG_TYPE_RGB != src->type) {
|
||||
|
|
|
@ -27,6 +27,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
|||
src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
|
||||
|
||||
/* no magic check here ? */
|
||||
if (dst->width || dst->height) {
|
||||
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
|
||||
|
@ -65,6 +67,8 @@ int wd, hd;
|
|||
int foo, x, y, x2, y2;
|
||||
float ac;
|
||||
|
||||
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
|
||||
|
||||
if (dst->width || dst->height) {
|
||||
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
|
||||
fimg_describe(dst, "destination halfsize 1");
|
||||
|
@ -108,7 +112,6 @@ return 0;
|
|||
/* --------------------------------------------------------------------- */
|
||||
int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect)
|
||||
{
|
||||
int foo;
|
||||
int xs, ys, xd, yd;
|
||||
int count;
|
||||
float rgb[3];
|
||||
|
@ -149,6 +152,8 @@ fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__,
|
|||
src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
|
||||
|
||||
if (fimg_images_not_compatible(src, dst)) {
|
||||
fprintf(stderr, "bad karma in %s\n", __func__);
|
||||
return -9;
|
||||
|
|
|
@ -85,7 +85,7 @@ float hh, ff, p, q, t;
|
|||
long i;
|
||||
|
||||
if(hsv[1] <= 0.0) { // < is bogus, just shuts up warnings
|
||||
rgb[0] = rgb[1] = rgb[2] = hsv[2];
|
||||
rgb[0] = rgb[1] = rgb[2] = (hsv[2] * scale);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,10 @@ int fimg_essai_hsv(char *fname)
|
|||
float colors[3], values[3], newcols[3];
|
||||
int foo, r, g, b;
|
||||
|
||||
fprintf(stderr, "%s NOT writing to %s\n", __func__, fname);
|
||||
|
||||
#define INC 16
|
||||
|
||||
for (r=0; r<255; r+=INC) {
|
||||
for (g=0; g<255; g+=INC) {
|
||||
for (b=0; b<255; b+=INC) {
|
||||
|
|
|
@ -20,9 +20,10 @@ static int check_boundaries(FloatImg *from, FloatImg *to, FimgArea51 *a51)
|
|||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, from, to, a51);
|
||||
#endif
|
||||
|
||||
fimg_printdims("from", from);
|
||||
fimg_printdims("to ", to);
|
||||
#endif
|
||||
|
||||
/* just a small molly-guard */
|
||||
if ( (a51->w < 0) || (a51->h < 0) ) {
|
||||
|
@ -30,13 +31,13 @@ if ( (a51->w < 0) || (a51->h < 0) ) {
|
|||
abort(); /* FY Bro ! */
|
||||
}
|
||||
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* XXX
|
||||
static int move_pixels(FloatImg *from, FloatImg *to,
|
||||
FimgArea51 *a51, int flags)
|
||||
{
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__,
|
||||
from, to, a51, flags);
|
||||
|
@ -44,6 +45,7 @@ fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__,
|
|||
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst,
|
||||
int xpos, int ypos, int flags)
|
||||
|
@ -58,6 +60,8 @@ fprintf(stderr, ">>> %s ( %p %p %d %d 0x%04X\n", __func__, psrc, pdst,
|
|||
xpos, ypos, flags);
|
||||
#endif
|
||||
|
||||
if (flags) { fprintf(stderr, "flags: 0x%04x in %s\n", flags, __func__); }
|
||||
|
||||
if (verbosity > 1) {
|
||||
fimg_describe(psrc, "source");
|
||||
fimg_describe(pdst, "destination");
|
||||
|
@ -67,6 +71,10 @@ if (verbosity > 1) {
|
|||
area.x = xpos; area.y = ypos;
|
||||
area.w = psrc->width; area.h = psrc->height;
|
||||
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) ||
|
||||
(ypos < 0) || (ypos > pdst->height - psrc->height) ) {
|
||||
|
|
|
@ -20,12 +20,12 @@ int line, col;
|
|||
int ir;
|
||||
|
||||
#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
|
||||
|
||||
fimg_clear(dst);
|
||||
if (k) { fprintf(stderr, "in %s k was %d\n", __func__, k); }
|
||||
|
||||
fimg_clear(dst);
|
||||
ir = 0;
|
||||
|
||||
for (line=0; line<src->height; line++) {
|
||||
|
|
|
@ -26,6 +26,10 @@ if (fimg->type != FIMG_TYPE_RGB) {
|
|||
return -6;
|
||||
}
|
||||
|
||||
if (type) {
|
||||
fprintf(stderr, "%s : %d %f\n", __func__, type, dval);
|
||||
}
|
||||
|
||||
/* rampe de primaires dans le quart du haut */
|
||||
val = (float)dval;
|
||||
for (x=0; x<fimg->width; x++) {
|
||||
|
|
|
@ -58,8 +58,8 @@ return 0;
|
|||
/* -------------------------------------------------------------- */
|
||||
/*
|
||||
* un essai dans la roulotte :)
|
||||
* 11 oct 2021 : premier jet, essai concluant, mais nécessite
|
||||
* du travail sur les rand() pour être plus 'noisy'
|
||||
* 11 oct 2021 : premier jet, essai concluant, mais necessite
|
||||
* du travail sur les rand() pour etre plus 'noisy'
|
||||
*
|
||||
*/
|
||||
int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur)
|
||||
|
@ -68,6 +68,8 @@ static int count = 0;
|
|||
static int flag = 0;
|
||||
int foo;
|
||||
|
||||
/* may be a mollyguard on 'largeur' parameter ? */
|
||||
|
||||
if (0==count) {
|
||||
if (flag) {
|
||||
count = irand2(5, 10);
|
||||
|
@ -87,7 +89,7 @@ if (verbosity) {
|
|||
fprintf(stderr, "%s: count=%d flag=%d\n", __func__, count, flag);
|
||||
}
|
||||
|
||||
foo = fimg_pixelize_h_0(psrc, pdst, flag ? 8 : 32);
|
||||
foo = fimg_pixelize_h_0(psrc, pdst, flag ? largeur : 32);
|
||||
if (foo) {
|
||||
fprintf(stderr, "PANIC in %s\n", __func__);
|
||||
abort();
|
||||
|
@ -97,6 +99,4 @@ count--; /* nice trick bro */
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
|
|
@ -31,13 +31,11 @@ for (y=0; y<img->height; y++) {
|
|||
for (x=0; x<img->width; x++) {
|
||||
dx = ((double)x/(double)img->width) - 0.5000;
|
||||
|
||||
rgb[0] = sin(dx*10 + time) + 1.0;
|
||||
rgb[1] = sin(dx*12 + time) + 1.0;
|
||||
rgb[2] = sin(dx*14 + time) + 1.0;
|
||||
rgb[0] = sin(dx*10 + time + dy) + 1.0;
|
||||
rgb[1] = sin(dx*12 + time + dy) + 1.0;
|
||||
rgb[2] = sin(dx*14 + time + dy) + 1.0;
|
||||
fimg_put_rgb(img, x, y, rgb);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -28,6 +28,8 @@ int foo, szimg;
|
|||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) { fprintf(stderr, "%s notused != 0, WTF ?\n", __func__); }
|
||||
|
||||
if (FIMG_TYPE_RGB != psrc->type) {
|
||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
||||
return -7;
|
||||
|
@ -78,6 +80,8 @@ float rgb[3];
|
|||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) { fprintf(stderr, "%s notused != 0, WTF ?\n", __func__); }
|
||||
|
||||
if (FIMG_TYPE_RGB != psrc->type) {
|
||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
||||
return -7;
|
||||
|
|
|
@ -25,6 +25,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
|||
src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) fprintf(stderr, "notused %d in %s\n", notused, __func__);
|
||||
|
||||
if (src->type != FIMG_TYPE_RGB) {
|
||||
fprintf(stderr, "%s: src type %d not valid\n", __func__,
|
||||
src->type);
|
||||
|
|
|
@ -26,7 +26,7 @@ if (FIMG_TYPE_RGB != fimg->type) {
|
|||
|
||||
nbpix = fimg->width * fimg->height;
|
||||
for (foo=0; foo<nbpix; foo++) {
|
||||
if (fimg->R[foo] > fimg->G[foo])
|
||||
if ((fimg->R[foo]+fval) > fimg->G[foo])
|
||||
fimg->B[foo] = fimg->R[foo];
|
||||
else
|
||||
fimg->B[foo] = fimg->G[foo];
|
||||
|
@ -50,7 +50,7 @@ if (FIMG_TYPE_RGB != fimg->type) {
|
|||
|
||||
nbpix = fimg->width * fimg->height;
|
||||
for (foo=0; foo<nbpix; foo++) {
|
||||
if (fimg->R[foo] > fimg->B[foo])
|
||||
if ((fimg->R[foo]+fval) > fimg->B[foo])
|
||||
fimg->G[foo] = fimg->R[foo];
|
||||
else
|
||||
fimg->G[foo] = fimg->B[foo];
|
||||
|
|
10
funcs/sfx2.c
10
funcs/sfx2.c
|
@ -25,6 +25,11 @@ int foo, size;
|
|||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
foo = fimg_get_minmax_rgb(pimg, mm);
|
||||
mR = (mm[1] - mm[0]) / 2.0;
|
||||
mG = (mm[3] - mm[2]) / 2.0;
|
||||
|
@ -54,6 +59,11 @@ float mm[6], mRa, mGa, mBa, mRb, mGb, mBb;
|
|||
float *fptr;
|
||||
int foo, size;
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, notused);
|
||||
#endif
|
||||
|
|
|
@ -28,9 +28,15 @@ fprintf(stderr, ">>> %s ( %p %p %f 0x%04x )\n", __func__,
|
|||
src, dst, kval, notused);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
halfval = fimg_get_maxvalue(src) / 2.0;
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: halfval=%f\n", __func__, halfval);
|
||||
fprintf(stderr, "%s: kval=%f & halfval=%f\n", __func__,
|
||||
kval, halfval);
|
||||
}
|
||||
|
||||
for (y=0; y<src->height; y++) {
|
||||
|
|
12
funcs/sfx4.c
12
funcs/sfx4.c
|
@ -25,6 +25,11 @@ float in[3], out[3];
|
|||
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
for (y=0; y<src->height; y++) {
|
||||
for (x=0; x<src->width; x++) {
|
||||
foo = fimg_get_rgb(src, x, y, in);
|
||||
|
@ -48,13 +53,18 @@ return 0;
|
|||
int fimg_split_level(FloatImg *src, FloatImg *dst, int notused)
|
||||
{
|
||||
float means[4];
|
||||
float in[3];
|
||||
// float in[3];
|
||||
int foo, idx, surface;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p 0x%04x )\n", __func__, src, dst, notused);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
foo = fimg_meanvalues(src, means);
|
||||
if (foo) {
|
||||
return -66;
|
||||
|
|
|
@ -30,12 +30,14 @@ fprintf(stderr, "\nEssais fausses couleurs (type %d) -> '%s'\n", type, dstfile);
|
|||
|
||||
foo = fimg_create(&src, W, H, FIMG_TYPE_RGB);
|
||||
foo = fimg_hdeg_a(&src, 12e3);
|
||||
// fimg_export_picture(&src, "debug.pnm", 0);
|
||||
foo = fimg_clone(&src, &dst, 0);
|
||||
foo = fimg_clear(&dst);
|
||||
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
|
|
@ -120,6 +120,11 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused)
|
|||
{
|
||||
int x, y, w, h, foo;
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
if (verbosity)
|
||||
fprintf(stderr, "parsing %s\n", str);
|
||||
|
||||
|
|
|
@ -21,7 +21,15 @@ int fimg_mk_gray_from(FloatImg *src, FloatImg *dst, int k)
|
|||
float kr, kg, kb, kdiv;
|
||||
int nbb, foo;
|
||||
|
||||
kr = kg = kb = 1.0; /* canonic random values */
|
||||
if (k) {
|
||||
/* 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;
|
||||
|
||||
/* we must check the validity of our parameters */
|
||||
|
@ -59,6 +67,10 @@ int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused)
|
|||
int foo, nbb;
|
||||
|
||||
/* 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) {
|
||||
fprintf(stderr, "%s : bad image type\n", __func__);
|
||||
return -18;
|
||||
|
|
|
@ -94,8 +94,8 @@ if (NULL == pmd) {
|
|||
}
|
||||
else {
|
||||
/* OK, get some funky metadatas */
|
||||
fprintf(stderr, "OK %s get funky metadatas\n", __func__);
|
||||
fprintf(stderr, "acquisition values %f %d\n", pmd->fval, pmd->count);
|
||||
// fprintf(stderr, "%s get metadatas\n", __func__);
|
||||
fprintf(stderr, "acqu fval=%f count=%d\n", pmd->fval, pmd->count);
|
||||
}
|
||||
|
||||
fp = fopen(fname, "w");
|
||||
|
@ -111,7 +111,7 @@ filehead.t = fimg->type;
|
|||
|
||||
/* XXX metadata */
|
||||
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';
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ if (1 != foo) {
|
|||
|
||||
/* we have metadata, put them on tape */
|
||||
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);
|
||||
if (1 != foo) {
|
||||
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
|
||||
* descriptor from calleris not blank ?
|
||||
* descriptor from caller is not blank ?
|
||||
*/
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
|
@ -328,7 +328,8 @@ if (foo) {
|
|||
* Oh boy, we have to skeep the metadata chunck
|
||||
*/
|
||||
if ('a' == filehead.magic[4]) {
|
||||
fprintf(stderr, "OMG %s metadata !!!\n", __func__);
|
||||
if (verbosity)
|
||||
{ fprintf(stderr, "%s: %s has metadata\n", __func__, fname); }
|
||||
foo = fseek(fp, (long)sizeof(FimgMetaData), SEEK_CUR);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : shit hit the fan\n", __func__);
|
||||
|
|
|
@ -303,6 +303,11 @@ int fimg_ajust_from_grab(FloatImg *fi, double maxima, int notused)
|
|||
{
|
||||
double coef;
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
if (fi->type != FIMG_TYPE_RGB) {
|
||||
fprintf(stderr, "%s : type %d invalide\n",
|
||||
__func__, fi->type);
|
||||
|
@ -324,6 +329,7 @@ if (verbosity) {
|
|||
fprintf(stderr, "image @ %p\n", fi);
|
||||
fprintf(stderr, "fval %f\n", fi->fval);
|
||||
fprintf(stderr, "count %d\n", fi->count);
|
||||
fprintf(stderr, "maxima %f\n", maxima);
|
||||
fprintf(stderr, "coef %f\n", coef);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,14 @@ int fimg_load_from_pnm(char *fname, FloatImg *head, int notused)
|
|||
FILE *fp;
|
||||
int width, height, maxval;
|
||||
int foo, line, column;
|
||||
unsigned char *buffline, *idxrd, dummychar;
|
||||
unsigned char *buffline, *idxrd;
|
||||
float *Rptr, *Gptr, *Bptr;
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
|
||||
if (NULL==head) {
|
||||
fprintf(stderr, "%s : head ptr is %p\n", __func__, head);
|
||||
return -8;
|
||||
|
@ -58,6 +63,7 @@ if (foo) {
|
|||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
unsigned char dummychar;
|
||||
fread(&dummychar, 1, 1, fp);
|
||||
fprintf(stderr, "%s : dummychar %xx\n", __func__, dummychar);
|
||||
#else
|
||||
|
|
|
@ -24,6 +24,8 @@ double fimg_timer_set(int whot)
|
|||
{
|
||||
double current;
|
||||
|
||||
if (whot) fprintf(stderr, "in %s whot is %d\n", __func__, whot);
|
||||
|
||||
current = dtime();
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
|
@ -36,6 +38,9 @@ return memory_time;
|
|||
double fimg_timer_get(int whot)
|
||||
{
|
||||
double current;
|
||||
|
||||
if (whot) fprintf(stderr, "in %s whot is %d\n", __func__, whot);
|
||||
|
||||
current = dtime();
|
||||
return current - memory_time;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -14,6 +15,9 @@
|
|||
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)
|
||||
{
|
||||
int foo;
|
||||
|
@ -37,10 +41,13 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
|
|||
pmd, title, notused);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "notused was %d, must be 0 in %s\n",
|
||||
notused, __func__);
|
||||
}
|
||||
if (NULL != title) {
|
||||
fprintf(stderr, "==== metadate for %s\n", title);
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "sizeof(metadata) = %ld\n", \
|
||||
sizeof(FimgMetaData));
|
||||
|
@ -49,9 +56,10 @@ if (verbosity) {
|
|||
|
||||
/* SHOW TIMESTAMP HERE */
|
||||
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 + \
|
||||
(double)pmd->timestamp.tv_usec / 1e6;
|
||||
fprintf(stderr, "dtime of day = %e\n", doubletime);
|
||||
fprintf(stderr, "dtime of day = %12.3f\n", doubletime);
|
||||
fprintf(stderr, "creator pid = %ld\n", pmd->cpid);
|
||||
fprintf(stderr, "float value = %.3f\n", pmd->fval);
|
||||
fprintf(stderr, "counter = %d\n", pmd->count);
|
||||
|
@ -85,8 +93,8 @@ if (foo) {
|
|||
}
|
||||
else {
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, " set TimeOfDay to %12ld , %8ld\n", \
|
||||
tvl.tv_sec, tvl.tv_usec);
|
||||
fprintf(stderr, "%s : set TimeOfDay to %12ld %8ld\n", \
|
||||
__func__, tvl.tv_sec, tvl.tv_usec);
|
||||
}
|
||||
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
|
||||
}
|
||||
|
|
21
lib/t.c
21
lib/t.c
|
@ -22,7 +22,7 @@ int foo;
|
|||
|
||||
fprintf(stderr, "-------- %s ( %s ) --------\n", __func__, fname);
|
||||
|
||||
foo = fimg_default_metadata(&Md);
|
||||
foo = fimg_default_metadata(&Md, 0);
|
||||
|
||||
// foo = fimg_show_metadata(&Md, "default from t.c", 0);
|
||||
|
||||
|
@ -33,8 +33,11 @@ if (foo) {
|
|||
}
|
||||
|
||||
foo = fimg_show_metadata(&Md, fname, 0);
|
||||
|
||||
return -1;
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: show metadata -> %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int essai_save_plane(int wot)
|
||||
|
@ -100,7 +103,8 @@ if (foo) {
|
|||
fprintf(stderr, "%s err create A %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
fimg_hdeg_a(&A, KDEG);
|
||||
if (k) fimg_hdeg_a(&A, KDEG);
|
||||
else fimg_vdeg_a(&A, KDEG);
|
||||
|
||||
foo = fimg_create(&B, WI, HI, FIMG_TYPE_RGB);
|
||||
if (foo) {
|
||||
|
@ -297,6 +301,12 @@ fimg_save_as_pnm(©, "cos_010.pnm", 0);
|
|||
fimg_destroy(&dessin); fimg_destroy(©);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
void help_me_obiwan(void)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -305,9 +315,10 @@ int foo, opt;
|
|||
// char outname[100];
|
||||
int gray = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "gn:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "ghn:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': gray++; break;
|
||||
case 'h': help_me_obiwan(); break;
|
||||
case 'n': foo=atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
default:
|
||||
|
|
|
@ -21,6 +21,11 @@ int foo, x, y, idx;
|
|||
fprintf(stderr, ">>> %s ( '%s' %s' )\n", __func__, srcname, dstname);
|
||||
#endif
|
||||
|
||||
if (notused) {
|
||||
fprintf(stderr, "in %s, notused must be 0, was %d !\n",
|
||||
__func__, notused);
|
||||
}
|
||||
|
||||
foo = fimg_create_from_dump(dstname, &dst);
|
||||
if (foo) fprintf(stderr, "create dst fimg from '%s' -> %d\n", dstname, foo);
|
||||
#if DEBUG_LEVEL
|
||||
|
|
|
@ -43,7 +43,7 @@ puts("\t-v\tincrease verbosity");
|
|||
puts("\t-o\tname of output file");
|
||||
puts("\t-g\tconvert to gray level");
|
||||
puts("");
|
||||
if (verbosity) { puts("Xperiment"); fimg_print_version(1); }
|
||||
if (verbosity) { puts("Xperiment"); fimg_print_version(v); }
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -65,7 +65,7 @@ g_width = g_height = 0;
|
|||
while ((opt = getopt(argc, argv, "gho:vx")) != -1) {
|
||||
switch(opt) {
|
||||
case 'g': to_gray = 1; break;
|
||||
case 'h': help(0); break;
|
||||
case 'h': help(1); break;
|
||||
case 'o': output_file = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'x': experiment++; break;
|
||||
|
|
|
@ -39,12 +39,13 @@ static void help(int k)
|
|||
{
|
||||
puts("export to FITS format");
|
||||
puts("\t-p select colorplane : R, G, B");
|
||||
fimg_print_version(k);
|
||||
}
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt;
|
||||
int opt;
|
||||
int plane = '?';
|
||||
|
||||
while ((opt = getopt(argc, argv, "p:hv")) != -1) {
|
||||
|
|
|
@ -64,7 +64,7 @@ puts("usage:\n\tfimg2png [options] foo.fimg bar.png");
|
|||
puts("options:");
|
||||
puts("\t-g\tconvert to gray");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(k);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ fprintf(stderr, ">>> %25s ( %p '%s' %d )\n", __func__,
|
|||
src, fname, flags);
|
||||
#endif
|
||||
|
||||
if (0 != flags) {
|
||||
fprintf(stderr, "bad flags in %s\n", __func__);
|
||||
}
|
||||
|
||||
fp = NULL; /* molly guard */
|
||||
if (strcmp("-", fname)) { /* real file */
|
||||
fprintf(stderr, "real file '%s'\n", fname);
|
||||
|
@ -142,7 +146,7 @@ puts("\t-n 3.14\t\tnormalize picture");
|
|||
puts("\t-s N\t\tsteps on x & y");
|
||||
if (verbosity) {
|
||||
printf("*** compiled: %s at %s\n", __DATE__, __TIME__);
|
||||
fimg_print_version(1);
|
||||
fimg_print_version(k);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
@ -153,11 +157,11 @@ int main(int argc, char *argv[])
|
|||
int foo, opt;
|
||||
int steps = 1;
|
||||
float norm_val = 222.0; /* < 0 : don't normalize */
|
||||
char separator = ' ';
|
||||
// char separator = ' ';
|
||||
|
||||
while ((opt = getopt(argc, argv, "f:hn:s:v")) != -1) {
|
||||
switch(opt) {
|
||||
case 'f': separator = optarg[0]; break;
|
||||
// case 'f': separator = optarg[0]; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'h': help(1); exit(1);
|
||||
case 's': steps = atoi(optarg); break;
|
||||
|
|
|
@ -65,7 +65,7 @@ puts("usage:\n\tfimg2tiff [options] foo.fimg bar.tiff");
|
|||
puts("options:");
|
||||
// puts("\t-g\tconvert to gray");
|
||||
puts("\t-v\tincrease verbosity");
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(k);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -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_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
|
||||
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
|
||||
Fx_absolute, Fx_clamp, Fx_shiftZ };
|
||||
Fx_absolute, Fx_clamp, Fx_fakol0 };
|
||||
|
||||
Fx fx_list[] = {
|
||||
{ "cos01", Fx_cos01, 0, 1 },
|
||||
|
@ -52,7 +52,7 @@ Fx fx_list[] = {
|
|||
{ "hilightr", Fx_hilight_R, 0, 1 },
|
||||
{ "abs", Fx_absolute, 0, 1 },
|
||||
{ "clamp", Fx_clamp, 0, 1 },
|
||||
{ "shiftzero", Fx_shiftZ, 0, 1 },
|
||||
{ "fakol0", Fx_fakol0, 0, 1 },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -171,7 +171,7 @@ else {
|
|||
|
||||
action = fx_list[fxidx].id;
|
||||
|
||||
if (verbosity) {
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: fxidx=%d action=%d\n", __func__,
|
||||
fxidx, action);
|
||||
}
|
||||
|
@ -189,7 +189,6 @@ switch (action) {
|
|||
case Fx_gray0: /* new 2020 01 10 */
|
||||
fimg_to_gray(&src); fimg_copy_data(&src, &dest);
|
||||
break;
|
||||
|
||||
case Fx_xper:
|
||||
do_experiment(&src, &dest, maxval); break;
|
||||
|
||||
|
@ -210,7 +209,6 @@ switch (action) {
|
|||
global_fvalue);
|
||||
foo = fimg_classif_trial(&src, &dest, global_fvalue, 0);
|
||||
break;
|
||||
|
||||
case Fx_desat:
|
||||
fimg_copy_data(&src, &dest);
|
||||
foo = fimg_mix_rgb_gray(&dest, global_fvalue);
|
||||
|
@ -221,9 +219,12 @@ switch (action) {
|
|||
case Fx_shift0:
|
||||
// fprintf(stderr, "Krkrk %d\n", action);
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** shiftzero -> %d\n", foo);
|
||||
}
|
||||
break;
|
||||
case Fx_trimul:
|
||||
fprintf(stderr, "trimul %d\n", action);
|
||||
// fprintf(stderr, "trimul %d\n", action);
|
||||
foo = fimg_sfx_triplemul(&src, &dest, 0);
|
||||
break;
|
||||
case Fx_ctr2x2:
|
||||
|
@ -253,12 +254,12 @@ switch (action) {
|
|||
if (foo > 0) foo = 0;
|
||||
break;
|
||||
|
||||
case Fx_shiftZ:
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** shiftzero -> %d\n", foo);
|
||||
}
|
||||
break;
|
||||
case Fx_fakol0:
|
||||
/***********************/
|
||||
/* DO SOMETHING HERE ! */
|
||||
/***********************/
|
||||
foo = fimg_falsecolors_0(&src, &dest, 0, 1.0);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s %s : %d is bad action\n",
|
||||
|
|
|
@ -52,6 +52,7 @@ void help(int u)
|
|||
puts("Usage:\n\tfimghalfsize [options] in.fimg out.fimg");
|
||||
puts("Options:");
|
||||
puts("\t-g\tconvert output to gray");
|
||||
fimg_print_version(u);
|
||||
exit(0);
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum comId { C_timestamp, C_count, C_fval, C_cpid, C_origin,
|
||||
int verbosity;
|
||||
|
||||
enum comId { C_timestamp, C_daytime, C_count, C_fval, C_cpid, C_origin,
|
||||
C_idcam, C_all };
|
||||
|
||||
typedef struct {
|
||||
|
@ -24,6 +25,7 @@ typedef struct {
|
|||
|
||||
Cmd Cmd_list[] = {
|
||||
{ "timestamp", C_timestamp },
|
||||
{ "daytime", C_daytime },
|
||||
{ "cpid", C_cpid },
|
||||
{ "count", C_count },
|
||||
{ "fval", C_fval },
|
||||
|
@ -73,7 +75,9 @@ action = lookup_cmd(command);
|
|||
|
||||
switch(action) {
|
||||
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:
|
||||
printf("count %d\n", metadata.count); break;
|
||||
case C_fval:
|
||||
|
@ -87,7 +91,7 @@ switch(action) {
|
|||
case C_all:
|
||||
fimg_show_metadata(&metadata, fname, 0); break;
|
||||
default:
|
||||
fprintf(stderr, "WTF?\n"); exit(1);
|
||||
fprintf(stderr, "%s WTF?\n", __func__); exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -104,7 +108,6 @@ exit(0);
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
int foo, opt, nbargs;
|
||||
char *fname;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
switch(opt) {
|
||||
|
|
|
@ -70,7 +70,7 @@ puts("options:");
|
|||
printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue);
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
pr_opcodes();
|
||||
if (verbosity) fimg_print_version(1);
|
||||
if (verbosity) fimg_print_version(lj);
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
|
|
@ -325,12 +325,11 @@ for (i = 0; i < nbre_capt; i++) {
|
|||
out_name);
|
||||
#endif
|
||||
|
||||
if (nbre_capt > 1 && period > 0.001) {
|
||||
if (nbre_capt > 1 && period > 0.0001) {
|
||||
/* suspend execution for
|
||||
microsecond intervals */
|
||||
usleep((int)(period*1E6));
|
||||
}
|
||||
|
||||
xioctl(fd, VIDIOC_QBUF, &buf);
|
||||
}
|
||||
|
||||
|
@ -378,6 +377,10 @@ switch (contrast) {
|
|||
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 */
|
||||
to_save = &cumul;
|
||||
if (90 == rotfactor) {
|
||||
|
@ -388,17 +391,23 @@ if (90 == rotfactor) {
|
|||
foo = fimg_save_as_png(&tmpfimg, "rot90.png", 0);
|
||||
}
|
||||
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);
|
||||
switch (foo) {
|
||||
case FILE_TYPE_FIMG:
|
||||
fimg_default_metadata(&metadata, 51);
|
||||
/* copy some values to mdstruct */
|
||||
metadata.fval = to_save->fval;
|
||||
metadata.count = to_save->count;
|
||||
if (add_metadata) {
|
||||
fprintf(stderr, ">>> save %s with md\n", outfile);
|
||||
fimg_default_metadata(&metadata, 51);
|
||||
/* copy some values to mdstruct */
|
||||
metadata.fval = to_save->fval;
|
||||
metadata.count = to_save->count;
|
||||
// fprintf(stderr, "-> save '%s' with metadata\n",
|
||||
// outfile);
|
||||
foo = fimg_dumpmd_to_file(to_save, outfile, \
|
||||
&metadata, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue