Compare commits
No commits in common. "3eed90c3e76363158d1f90db1e45cc294b0f6040" and "f63f918530955994b7dc3e2dd4cdb4c09f6a2153" have entirely different histories.
3eed90c3e7
...
f63f918530
@ -122,7 +122,7 @@ int foo, idx, ipng, w, h, step;
|
||||
int curpix;
|
||||
int iarray[3];
|
||||
char *cptr, line[200];
|
||||
float coef;
|
||||
float coef, value;
|
||||
double meanmetric;
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
value = idx_values[idx].value; /* WTF ? */
|
||||
|
||||
/* here was the input filter */
|
||||
foo = filterstack_run(0, &B, 0);
|
||||
|
14
LICENSE
14
LICENSE
@ -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.
|
||||
|
3
Makefile
3
Makefile
@ -13,9 +13,6 @@ all: essai
|
||||
essai: essai.c libfloatimg.a floatimg.h Makefile
|
||||
gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
|
||||
|
||||
install:
|
||||
@echo "=== Use the 'install.sh' script ==="
|
||||
|
||||
#---------------------------------------------------------------
|
||||
|
||||
TOTAR = *.[ch] Makefile *.sh *.md \
|
||||
|
12
README.md
12
README.md
@ -38,18 +38,8 @@ 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, du
|
||||
genre que c'est la deuxième fois que ça m'arrive.
|
||||
Et ya Debian qui change des trucs, alors, ça marche plus
|
||||
|
||||
```
|
||||
E: Unable to locate package libv4l2-dev
|
||||
|
37
floatimg.h
37
floatimg.h
@ -1,29 +1,14 @@
|
||||
/*
|
||||
* 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 (197)
|
||||
#define FIMG_VERSION (187)
|
||||
#define RELEASE_NAME ("noname")
|
||||
/*
|
||||
* in memory descriptor of a floating image
|
||||
* in memory descriptor
|
||||
*/
|
||||
#define MAGIC_FIMG 0x00F11F00
|
||||
typedef struct {
|
||||
@ -43,11 +28,7 @@ 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.
|
||||
@ -65,7 +46,7 @@ typedef struct {
|
||||
} FimgMetaData;
|
||||
/*
|
||||
* 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_maximum(FloatImg *a, FloatImg *b, FloatImg *d);
|
||||
|
||||
|
||||
/* ---------------------------------------------------- */
|
||||
/* 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);
|
||||
|
||||
/* ---------------------------------------------------- */
|
||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse);
|
||||
|
||||
/* module sfx0.c */
|
||||
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
||||
|
@ -8,19 +8,13 @@ __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. Mais difficile.
|
||||
Détecter des contours est une activité respectable.
|
||||
|
||||
## 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 flags)
|
||||
int fimg_classif_trial(FloatImg *psrc, FloatImg *pdst, float fval, int notused)
|
||||
{
|
||||
float minmax[6], delta[3], baryc[3];
|
||||
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);
|
||||
#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,14 +23,15 @@ 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)
|
||||
@ -44,9 +45,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
psrc, pdst, k);
|
||||
#endif
|
||||
|
||||
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,9 +102,8 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
psrc, pdst, k);
|
||||
#endif
|
||||
|
||||
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,12 +17,6 @@ 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,8 +32,6 @@ 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];
|
||||
@ -47,7 +45,7 @@ if ( (minmax[0]<0.0) || (minmax[2]<0.0) || (minmax[4]<0.0) ) {
|
||||
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;
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ 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,15 +1,11 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
@ -17,67 +13,27 @@
|
||||
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, offset;
|
||||
float r, g, b, gray, maxv;
|
||||
int x, y;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__,
|
||||
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 (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;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -16,7 +16,7 @@ extern int verbosity;
|
||||
int fimg_show_filter(char *title, FimgFilter3x3 *filtr)
|
||||
{
|
||||
float *M; /* alias of filter matrix */
|
||||
int idx;
|
||||
int foo, idx;
|
||||
float sum, value;
|
||||
|
||||
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);
|
||||
|
||||
value = (sum * filtr->mult) + filtr->offset;
|
||||
fprintf(stderr, " value %8.3f ???\n", value);
|
||||
fprintf(stderr, " value %8.3f ???\n", sum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -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); /* please explain XXX */
|
||||
fprintf(stderr, "planeptr is %p\n", planeptr);
|
||||
planeptr = charplane2int(plane, src);
|
||||
|
||||
if (verbosity) {
|
||||
fimg_describe(src, outname);
|
||||
|
@ -32,8 +32,6 @@ 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 *text)
|
||||
static void print_struct_pam(struct pam *ppam, char *txt)
|
||||
{
|
||||
printf(" text %s\n", text);
|
||||
|
||||
printf(" size %d\n", ppam->size);
|
||||
|
||||
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(" depth %d\n", ppam->depth);
|
||||
printf(" maxval %lu\n", ppam->maxval);
|
||||
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
@ -23,9 +23,6 @@ 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,8 +27,6 @@ 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);
|
||||
@ -67,8 +65,6 @@ 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");
|
||||
@ -112,6 +108,7 @@ return 0;
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect)
|
||||
{
|
||||
int foo;
|
||||
int xs, ys, xd, yd;
|
||||
int count;
|
||||
float rgb[3];
|
||||
@ -152,8 +149,6 @@ 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] * scale);
|
||||
rgb[0] = rgb[1] = rgb[2] = hsv[2];
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -131,10 +131,7 @@ 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,10 +20,9 @@ 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) ) {
|
||||
@ -31,13 +30,13 @@ if ( (a51->w < 0) || (a51->h < 0) ) {
|
||||
abort(); /* FY Bro ! */
|
||||
}
|
||||
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* 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);
|
||||
@ -45,7 +44,6 @@ 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)
|
||||
@ -60,8 +58,6 @@ 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");
|
||||
@ -71,10 +67,6 @@ 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
|
||||
|
||||
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,10 +26,6 @@ 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 necessite
|
||||
* du travail sur les rand() pour etre plus 'noisy'
|
||||
* 11 oct 2021 : premier jet, essai concluant, mais nécessite
|
||||
* du travail sur les rand() pour être plus 'noisy'
|
||||
*
|
||||
*/
|
||||
int fimg_pixelize_h_rnd(FloatImg *psrc, FloatImg *pdst, int largeur)
|
||||
@ -68,8 +68,6 @@ 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);
|
||||
@ -89,7 +87,7 @@ if (verbosity) {
|
||||
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) {
|
||||
fprintf(stderr, "PANIC in %s\n", __func__);
|
||||
abort();
|
||||
@ -99,4 +97,6 @@ count--; /* nice trick bro */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
|
@ -31,11 +31,13 @@ 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 + dy) + 1.0;
|
||||
rgb[1] = sin(dx*12 + time + dy) + 1.0;
|
||||
rgb[2] = sin(dx*14 + time + dy) + 1.0;
|
||||
rgb[0] = sin(dx*10 + time) + 1.0;
|
||||
rgb[1] = sin(dx*12 + time) + 1.0;
|
||||
rgb[2] = sin(dx*14 + time) + 1.0;
|
||||
fimg_put_rgb(img, x, y, rgb);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -28,8 +28,6 @@ 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;
|
||||
@ -80,8 +78,6 @@ 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,8 +25,6 @@ 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]+fval) > fimg->G[foo])
|
||||
if (fimg->R[foo] > 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]+fval) > fimg->B[foo])
|
||||
if (fimg->R[foo] > 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,11 +25,6 @@ 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;
|
||||
@ -59,11 +54,6 @@ 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,15 +28,9 @@ 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: kval=%f & halfval=%f\n", __func__,
|
||||
kval, halfval);
|
||||
fprintf(stderr, "%s: halfval=%f\n", __func__, halfval);
|
||||
}
|
||||
|
||||
for (y=0; y<src->height; y++) {
|
||||
|
12
funcs/sfx4.c
12
funcs/sfx4.c
@ -25,11 +25,6 @@ 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);
|
||||
@ -53,18 +48,13 @@ 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,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_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);
|
||||
|
||||
fimg_destroy(&src); fimg_destroy(&dst);
|
||||
|
||||
return -1;
|
||||
|
@ -120,11 +120,6 @@ 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,15 +21,7 @@ int fimg_mk_gray_from(FloatImg *src, FloatImg *dst, int k)
|
||||
float kr, kg, kb, kdiv;
|
||||
int nbb, foo;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
kr = kg = kb = 1.0; /* canonic random values */
|
||||
kdiv = kr + kg + kb;
|
||||
|
||||
/* we must check the validity of our parameters */
|
||||
@ -67,10 +59,6 @@ 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, "%s get metadatas\n", __func__);
|
||||
fprintf(stderr, "acqu fval=%f count=%d\n", pmd->fval, pmd->count);
|
||||
fprintf(stderr, "OK %s get funky metadatas\n", __func__);
|
||||
fprintf(stderr, "acquisition values %f %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 caller is not blank ?
|
||||
* descriptor from calleris not blank ?
|
||||
*/
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
@ -328,8 +328,7 @@ if (foo) {
|
||||
* Oh boy, we have to skeep the metadata chunck
|
||||
*/
|
||||
if ('a' == filehead.magic[4]) {
|
||||
if (verbosity)
|
||||
{ fprintf(stderr, "%s: %s has metadata\n", __func__, fname); }
|
||||
fprintf(stderr, "OMG %s metadata !!!\n", __func__);
|
||||
foo = fseek(fp, (long)sizeof(FimgMetaData), SEEK_CUR);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : shit hit the fan\n", __func__);
|
||||
|
@ -303,11 +303,6 @@ 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);
|
||||
@ -329,7 +324,6 @@ 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,14 +23,9 @@ 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;
|
||||
unsigned char *buffline, *idxrd, dummychar;
|
||||
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;
|
||||
@ -63,7 +58,6 @@ if (foo) {
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
unsigned char dummychar;
|
||||
fread(&dummychar, 1, 1, fp);
|
||||
fprintf(stderr, "%s : dummychar %xx\n", __func__, dummychar);
|
||||
#else
|
||||
|
@ -24,8 +24,6 @@ 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
|
||||
@ -38,9 +36,6 @@ 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,7 +6,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -15,9 +14,6 @@
|
||||
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;
|
||||
@ -41,13 +37,10 @@ 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));
|
||||
@ -56,10 +49,9 @@ 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 = %12.3f\n", doubletime);
|
||||
fprintf(stderr, "dtime of day = %e\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);
|
||||
@ -93,8 +85,8 @@ if (foo) {
|
||||
}
|
||||
else {
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s : set TimeOfDay to %12ld %8ld\n", \
|
||||
__func__, tvl.tv_sec, tvl.tv_usec);
|
||||
fprintf(stderr, " set TimeOfDay to %12ld , %8ld\n", \
|
||||
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, 0);
|
||||
foo = fimg_default_metadata(&Md);
|
||||
|
||||
// foo = fimg_show_metadata(&Md, "default from t.c", 0);
|
||||
|
||||
@ -33,11 +33,8 @@ if (foo) {
|
||||
}
|
||||
|
||||
foo = fimg_show_metadata(&Md, fname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: show metadata -> %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int essai_save_plane(int wot)
|
||||
@ -103,8 +100,7 @@ if (foo) {
|
||||
fprintf(stderr, "%s err create A %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
if (k) fimg_hdeg_a(&A, KDEG);
|
||||
else fimg_vdeg_a(&A, KDEG);
|
||||
fimg_hdeg_a(&A, KDEG);
|
||||
|
||||
foo = fimg_create(&B, WI, HI, FIMG_TYPE_RGB);
|
||||
if (foo) {
|
||||
@ -301,12 +297,6 @@ 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[])
|
||||
@ -315,10 +305,9 @@ int foo, opt;
|
||||
// char outname[100];
|
||||
int gray = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "ghn:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "gn: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,11 +21,6 @@ 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(v); }
|
||||
if (verbosity) { puts("Xperiment"); fimg_print_version(1); }
|
||||
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(1); break;
|
||||
case 'h': help(0); break;
|
||||
case 'o': output_file = optarg; break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'x': experiment++; break;
|
||||
|
@ -39,13 +39,12 @@ 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 opt;
|
||||
int foo, 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(k);
|
||||
if (verbosity) fimg_print_version(1);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -25,10 +25,6 @@ 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);
|
||||
@ -146,7 +142,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(k);
|
||||
fimg_print_version(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
@ -157,11 +153,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(k);
|
||||
if (verbosity) fimg_print_version(1);
|
||||
|
||||
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_fakol0 };
|
||||
Fx_absolute, Fx_clamp, Fx_shiftZ };
|
||||
|
||||
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 },
|
||||
{ "fakol0", Fx_fakol0, 0, 1 },
|
||||
{ "shiftzero", Fx_shiftZ, 0, 1 },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -171,11 +171,6 @@ else {
|
||||
|
||||
action = fx_list[fxidx].id;
|
||||
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "%s: fxidx=%d action=%d\n", __func__,
|
||||
fxidx, action);
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case Fx_cos01:
|
||||
fimg_cos_01(&src, &dest, maxval); break;
|
||||
@ -189,6 +184,7 @@ 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;
|
||||
|
||||
@ -209,6 +205,7 @@ 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);
|
||||
@ -219,12 +216,9 @@ 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:
|
||||
@ -254,11 +248,11 @@ switch (action) {
|
||||
if (foo > 0) foo = 0;
|
||||
break;
|
||||
|
||||
case Fx_fakol0:
|
||||
/***********************/
|
||||
/* DO SOMETHING HERE ! */
|
||||
/***********************/
|
||||
foo = fimg_falsecolors_0(&src, &dest, 0, 1.0);
|
||||
case Fx_shiftZ:
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** shiftzero -> %d\n", foo);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -315,10 +309,6 @@ if (3 > argc-optind) {
|
||||
}
|
||||
|
||||
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];
|
||||
action = lookup_fxidx(operator);
|
||||
|
@ -52,7 +52,6 @@ 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,11 +11,10 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
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 };
|
||||
|
||||
typedef struct {
|
||||
@ -25,7 +24,6 @@ typedef struct {
|
||||
|
||||
Cmd Cmd_list[] = {
|
||||
{ "timestamp", C_timestamp },
|
||||
{ "daytime", C_daytime },
|
||||
{ "cpid", C_cpid },
|
||||
{ "count", C_count },
|
||||
{ "fval", C_fval },
|
||||
@ -76,8 +74,6 @@ action = lookup_cmd(command);
|
||||
switch(action) {
|
||||
case C_timestamp:
|
||||
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:
|
||||
@ -91,7 +87,7 @@ switch(action) {
|
||||
case C_all:
|
||||
fimg_show_metadata(&metadata, fname, 0); break;
|
||||
default:
|
||||
fprintf(stderr, "%s WTF?\n", __func__); exit(1);
|
||||
fprintf(stderr, "WTF?\n"); exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -108,6 +104,7 @@ 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(lj);
|
||||
if (verbosity) fimg_print_version(1);
|
||||
exit(0);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -325,11 +325,12 @@ for (i = 0; i < nbre_capt; i++) {
|
||||
out_name);
|
||||
#endif
|
||||
|
||||
if (nbre_capt > 1 && period > 0.0001) {
|
||||
if (nbre_capt > 1 && period > 0.001) {
|
||||
/* suspend execution for
|
||||
microsecond intervals */
|
||||
usleep((int)(period*1E6));
|
||||
}
|
||||
|
||||
xioctl(fd, VIDIOC_QBUF, &buf);
|
||||
}
|
||||
|
||||
@ -377,10 +378,6 @@ 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) {
|
||||
@ -391,23 +388,17 @@ 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:
|
||||
if (add_metadata) {
|
||||
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);
|
||||
if (add_metadata) {
|
||||
fprintf(stderr, ">>> save %s with md\n", outfile);
|
||||
foo = fimg_dumpmd_to_file(to_save, outfile, \
|
||||
&metadata, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user