Compare commits

..

No commits in common. "e224ab83b6216811af030e762e87a53aba5335c4" and "4dcc524fc4484791c6682328564d0ad1173a0fa4" have entirely different histories.

22 changed files with 43 additions and 269 deletions

View File

@ -212,20 +212,6 @@ ret = fimg_decomp_rgbz_color(img, &tmp, k);
fimg_copy_data(&tmp, img); fimg_copy_data(&tmp, img);
fimg_destroy(&tmp); fimg_destroy(&tmp);
return ret;
}
/* -------------------------------------------------------------- */
/* nouveau 14 mai 2022 */
static int run_gr2popcol(FloatImg *img, int k)
{
FloatImg tmp;
int ret;
memset(&tmp, 0, sizeof(FloatImg));
fimg_clone(img, &tmp, 0);
ret = graylevel2popcolors(img, &tmp, k);
fimg_copy_data(&tmp, img);
fimg_destroy(&tmp);
return ret; return ret;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
@ -438,11 +424,6 @@ switch (idFx) {
retval = fimg_highlight_color(image, image, 'R', 1.717); retval = fimg_highlight_color(image, image, 'R', 1.717);
break; break;
case CR_gr2popcol:
// fprintf(stderr, "******* TO BE DONE ********\n");
retval = run_gr2popcol(image, -1);
break;
default : default :
fprintf(stderr, "%s : effect #%d invalid\n", fprintf(stderr, "%s : effect #%d invalid\n",
__func__, idFx); __func__, idFx);

View File

@ -41,6 +41,5 @@
49 splitlevel 1 1 49 splitlevel 1 1
50 decrgbzc 1 99 50 decrgbzc 1 99
51 decrgbzg 1 99 51 decrgbzg 1 99
60 gr2popcol 1 99
99 message 1 1.0 99 message 1 1.0
-1 end 1 1.0 -1 end 1 1.0

View File

@ -21,42 +21,6 @@
*/ */
extern int verbosity; extern int verbosity;
/* -------------------------------------------------------------- */
/* nouveau 14 mai 2022 rue Ernest Renan */
int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k)
{
int x, y;
float rgb[3];
float theoric_maxval, real_maxv;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k);
#endif
theoric_maxval = src->fval * src->count;
real_maxv = fimg_get_maxvalue(src);
#if DEBUG_LEVEL
fprintf(stderr, "maxval: theoric= %.3f real= %.3f\n", \
theoric_maxval, real_maxv);
#endif
fimg_clear(dst);
for (y=0; y<src->height; y++) {
for (x=0; x<src->width; x++)
{
fimg_get_rgb(src, x, y, rgb);
rgb[0] = real_maxv * fabs(cos(21.0 * rgb[0] / real_maxv));
rgb[1] = real_maxv * fabs(cos(31.0 * rgb[1] / real_maxv));
rgb[2] = real_maxv * fabs(cos(11.0 * rgb[2] / real_maxv));
fimg_put_rgb(dst, x, y, rgb);
}
}
return 0;
}
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* /*
* please, add some parameters ! * please, add some parameters !

View File

@ -3,8 +3,6 @@
* --------------------------------------------------- * ---------------------------------------------------
*/ */
int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k);
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k); int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);

View File

@ -166,19 +166,19 @@ int experiment(void)
int foo; int foo;
FloatImg image, dest; FloatImg image, dest;
fprintf(stderr, "--------- EXPERIMENT ------------\n"); fprintf(stderr, "EXPERIMENT\n");
foo = fimg_create_from_dump("mire.fimg", &image); foo = fimg_create_from_dump("01137.fimg", &image);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d on create_from_dump\n", fprintf(stderr, "%s: err %d on create_from_dump\n",
__func__, foo); __func__, foo);
return -1; return -1;
} }
foo = fimg_clone(&image, &dest, 0); foo = fimg_clone(&image, &dest, 1);
foo = fimg_copy_data(&image, &dest);
foo = graylevel2popcolors(&image, &dest, 0); incrustation_vignette(&image, &dest, 0);
fprintf(stderr, "POP COLOR- -> %d\n", foo);
fimg_export_picture(&dest, "foo.png", 0); fimg_export_picture(&dest, "foo.png", 0);

View File

@ -5,7 +5,7 @@
* https://git.tetalab.org/tTh/FloatImg * https://git.tetalab.org/tTh/FloatImg
*/ */
#define FIMG_VERSION (187) #define FIMG_VERSION (182)
#define RELEASE_NAME ("noname") #define RELEASE_NAME ("noname")
/* /*
* in memory descriptor * in memory descriptor
@ -45,9 +45,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 thing about a fised size of this datablock
*/
#define MAGIC_AREA51 0xA5EA0051 #define MAGIC_AREA51 0xA5EA0051
@ -189,9 +187,6 @@ int fimg_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]); int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
int fimg_auto_shift_to_zero(FloatImg *s, FloatImg *d); int fimg_auto_shift_to_zero(FloatImg *s, FloatImg *d);
/* funcs/falsecolors.c */
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf);
/* --> funcs/plasmas.c */ /* --> funcs/plasmas.c */
int fimg_prototype_plasma(FloatImg *img, double time, int type); int fimg_prototype_plasma(FloatImg *img, double time, int type);
@ -238,7 +233,7 @@ int fimg_create_from_dump(char *fname, FloatImg *head);
/* FIMG metadata module */ /* FIMG metadata module */
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused); int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused);
int fimg_default_metadata(FimgMetaData *pmd, int bla); int fimg_default_metadata(FimgMetaData *pmd);
int fimg_get_metadata_from_file(char *fname, FimgMetaData *pmd); int fimg_get_metadata_from_file(char *fname, FimgMetaData *pmd);
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags); int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);

View File

@ -9,7 +9,6 @@ DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o rectangle.o \ fimg-libpnm.o rampes.o rectangle.o \
sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \ sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \
falsecolors.o \
geometry.o rotate.o fimg-openexr.o \ geometry.o rotate.o fimg-openexr.o \
equalize.o fimg-fits.o saturation.o histogram.o \ equalize.o fimg-fits.o saturation.o histogram.o \
fimg-dicom.o \ fimg-dicom.o \
@ -138,9 +137,6 @@ qsortrgb.o: qsortrgb.c $(DEPS)
exporter.o: exporter.c $(DEPS) exporter.o: exporter.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<
falsecolors.o: falsecolors.c $(DEPS)
gcc $(COPT) -c $<
hsv.o: hsv.c $(DEPS) hsv.o: hsv.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

View File

@ -1,39 +0,0 @@
/*
* FloatImg library from tTh - really ugly code inside
*/
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#include "../floatimg.h"
/* -------------------------------------------------------------- */
/* this is a global vars exported from main */
extern int verbosity;
/* -------------------------------------------------------------- */
/* -------------------------------------------------------------- */
/* nouveau 18 mai 2022 */
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf)
{
int x, y;
fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__,
src, dst, k, valf);
for (y=0; y<src->height, y++) {
for (x=0; x<src->width, x++) {
/***********************/
/* DO SOMETHING HERE ! */
/***********************/
}
}
return -1;
}
/* -------------------------------------------------------------- */

View File

@ -25,7 +25,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Displace, ReadPNG, Plasmas, Hilight, OpenEXR, Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
Geometrie, FileType, Mirror, KillRGB, Geometrie, FileType, Mirror, KillRGB,
Pixelize,SplitLevel, DecompRgbz, DecompRgbg, Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
Rectangle, Dicom, Fakolor0, Fakolor3 }; Rectangle, Dicom };
typedef struct { typedef struct {
char *name; char *name;
int Cmd; int Cmd;
@ -60,8 +60,6 @@ Command commands[] = {
{ "decomprgbg", DecompRgbg }, { "decomprgbg", DecompRgbg },
{ "rectangle", Rectangle }, { "rectangle", Rectangle },
{ "dicom", Dicom }, { "dicom", Dicom },
{ "fakolor0", Fakolor0 },
{ "fakolor3", Fakolor3 },
{ NULL, 0 } { NULL, 0 }
} ; } ;
@ -250,9 +248,7 @@ switch(opt) {
case Dicom: case Dicom:
foo = essai_dicom(filename, outfile, 0); foo = essai_dicom(filename, outfile, 0);
break; break;
case Fakolor0:
foo = essai_0_fausses_couleurs(outfile, 0);
break;
default: default:
fprintf(stderr, "'%s' is a bad command\n", command); fprintf(stderr, "'%s' is a bad command\n", command);
exit(1); exit(1);
@ -260,7 +256,7 @@ switch(opt) {
} }
if (foo) { if (foo) {
fprintf(stderr, "******* essai --> %d\n\n", foo); fprintf(stderr, "******* Essai --> %d\n", foo);
} }
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid()); fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid());

View File

@ -18,26 +18,6 @@
extern int verbosity; extern int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* nouveau 18 mai 2022 */
int essai_0_fausses_couleurs(char *dstfile, int type)
{
FloatImg src, dst;
int foo;
#define W 1024
#define H 768
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);
foo = fimg_clone(&src, &dst, 0);
foo = fimg_clear(&dst);
foo = fimg_falsecolors_0(&src, &dst, type, 3.141592654);
foo= fimg_export_picture(&dst, dstfile, 0);
return -1;
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int essai_dicom(char *inf, char *outf, int k) int essai_dicom(char *inf, char *outf, int k)
{ {
@ -61,10 +41,6 @@ FloatImg img;
int foo; int foo;
int rect[4]; int rect[4];
if (0 != k) {
fprintf(stderr, "in %s, k muste be 0, was %d\n", __func__, k);
}
foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB); foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB);
fimg_drand48(&img, 1.0); fimg_drand48(&img, 1.0);
@ -765,10 +741,6 @@ int essai_geometrie(char *infile, int notused)
FloatImg fimg, result; FloatImg fimg, result;
int foo; int foo;
if (0 != notused) {
fprintf(stderr, "in %s, k must be 0, was %d\n", __func__, notused);
}
if (NULL != infile) { if (NULL != infile) {
fprintf(stderr, "loading %s\n", infile); fprintf(stderr, "loading %s\n", infile);
foo = fimg_create_from_dump(infile, &fimg); foo = fimg_create_from_dump(infile, &fimg);
@ -907,17 +879,13 @@ int essai_mire(char *outname, int notused)
FloatImg fimg; FloatImg fimg;
int re, foo; int re, foo;
if (0 != notused) {
fprintf(stderr, "in %s, k must be 0, was %d\n", __func__, notused);
}
fimg_create(&fimg, 1280, 960, FIMG_TYPE_RGB); fimg_create(&fimg, 1280, 960, FIMG_TYPE_RGB);
re = fimg_test_pattern(&fimg, 9, 1.0); re = fimg_test_pattern(&fimg, 9, 1.0);
if (re) { if (re) {
fprintf(stderr, "fimg_test_pattern -> %d\n", re); fprintf(stderr, "fimg_test_pattern -> %d\n", re);
} }
foo = fimg_export_picture(&fimg, outname, 0); foo = fimg_export_picture(&fimg, "mire.pnm", 0);
fprintf(stderr, "in %s, export give a %d value\n", __func__, foo); fprintf(stderr, "in %s, export give a %d value\n", __func__, foo);
return 0; return 0;

View File

@ -28,7 +28,6 @@ int essai_geometrie(char *infile, int notused);
int essai_detect_type(void); int essai_detect_type(void);
int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */ int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
int essai_histogramme(char *fname, int k); int essai_histogramme(char *fname, int k);
int essai_0_fausses_couleurs(char *dstfile, int type);
int essai_lecture_png(char *fname, char *outfile, int notused); int essai_lecture_png(char *fname, char *outfile, int notused);

View File

@ -48,7 +48,7 @@ if (memcmp(filehead.magic, "FIMG", 4)) {
/* XXX preparer la gestion des metadata */ /* XXX preparer la gestion des metadata */
if ('a' == filehead.magic[4]) { if ('a' == filehead.magic[4]) {
fprintf(stderr,"\n\t****** %s have metadata\n\n", fname); fprintf(stderr,"****** %s have metadata\n", fname);
} }
datas[0] = filehead.w; datas[0] = filehead.w;
@ -67,7 +67,6 @@ int fimg_dumpmd_to_file(FloatImg *fimg, char *fname, \
FILE *fp; FILE *fp;
int foo, nbre; int foo, nbre;
FimgFileHead filehead; FimgFileHead filehead;
FimgMetaData fakemd;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p '%s' %p %d )\n", __func__, fimg, fprintf(stderr, ">>> %s ( %p '%s' %p %d )\n", __func__, fimg,
@ -84,20 +83,6 @@ if (FIMG_TYPE_RGB != fimg->type) {
return -8; return -8;
} }
/* OK, we have to make a fake metadata chunk, if the caller
* don't have one. Ugly, and nice */
if (NULL == pmd) {
fprintf(stderr, ">>> %s making faked metadata\n", __func__);
foo = fimg_default_metadata(&fakemd, 3);
fprintf(stderr, "fakemd is at %p\n", &fakemd);
pmd = &fakemd;
}
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);
}
fp = fopen(fname, "w"); fp = fopen(fname, "w");
if (NULL==fp) { if (NULL==fp) {
perror(fname); perror(fname);
@ -111,7 +96,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__);
filehead.magic[4] = 'a'; filehead.magic[4] = 'a';
} }
@ -123,9 +108,8 @@ if (1 != foo) {
return -2; return -2;
} }
/* we have metadata, put them on tape */ /* XXX metadata */
if (NULL != pmd) { if (NULL != 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);
@ -252,12 +236,6 @@ if ( (filehead.w != where->width) ||
/* XXX preparer la gestion des metadata */ /* XXX preparer la gestion des metadata */
if ('a' == filehead.magic[4]) { if ('a' == filehead.magic[4]) {
fprintf(stderr,"****** %s have metadata\n", fname); fprintf(stderr,"****** %s have metadata\n", fname);
foo = fseek(fp, (long)sizeof(FimgMetaData), SEEK_CUR);
if (foo) {
fprintf(stderr, "%s: seek error\n", __func__);
perror(fname);
exit(1);
}
} }
nbre = filehead.w * filehead.h; /* number of pixels per frame */ nbre = filehead.w * filehead.h; /* number of pixels per frame */
@ -296,7 +274,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 calleris not blank ? * descriptor is not blank ?
*/ */
fp = fopen(fname, "r"); fp = fopen(fname, "r");
@ -323,19 +301,6 @@ if (foo) {
return foo; return foo;
} }
/* bugfix Sat 14 May 2022 07:02:53 PM CEST */
/*
* Oh boy, we have to skeep the metadata chunck
*/
if ('a' == filehead.magic[4]) {
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__);
abort();
}
}
size = filehead.w * filehead.h; size = filehead.w * filehead.h;
nbread = 0; nbread = 0;
nbread += fread(head->R, sizeof(float), size, fp); nbread += fread(head->R, sizeof(float), size, fp);

View File

@ -37,10 +37,6 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
pmd, title, notused); pmd, title, notused);
#endif #endif
if (NULL != 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));
@ -53,8 +49,8 @@ doubletime = (double)pmd->timestamp.tv_sec + \
(double)pmd->timestamp.tv_usec / 1e6; (double)pmd->timestamp.tv_usec / 1e6;
fprintf(stderr, "dtime of day = %e\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, "counter = %d\n", pmd->count); fprintf(stderr, "counter = %d\n", pmd->count);
fprintf(stderr, "float value = %.3f\n", pmd->fval);
fprintf(stderr, "id camera = '%s'\n", pmd->idcam); fprintf(stderr, "id camera = '%s'\n", pmd->idcam);
fprintf(stderr, "origin = 0x%x\n", pmd->origin); fprintf(stderr, "origin = 0x%x\n", pmd->origin);
@ -67,7 +63,7 @@ fputc('\n', stderr);
return 0; return 0;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
int fimg_default_metadata(FimgMetaData *pmd, int bla) int fimg_default_metadata(FimgMetaData *pmd)
{ {
int foo; int foo;
struct timeval tvl; struct timeval tvl;
@ -84,20 +80,18 @@ if (foo) {
perror("omg"); perror("omg");
} }
else { else {
if (verbosity > 1) { if (verbosity) {
fprintf(stderr, " set TimeOfDay to %12ld , %8ld\n", \ fprintf(stderr, "Time of day %12ld %12ld\n", \
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));
} }
pmd->cpid = getpid(); // we are the creator, no ? pmd->cpid = getpid();
pmd->count = 1; // mmmm... pmd->count = 0;
pmd->fval = 255.0; // Ok pmd->fval = 255.0;
strcpy(pmd->idcam, "<noname>"); strcpy(pmd->idcam, "<unknow>");
pmd->origin = 0xdeadbeef; // classic joke, sorry pmd->origin = 0xdeadbeef;
pmd->reserved[0] = bla;
pmd->reserved[7] = 0x55445544; // magic number is a crime
return 0; return 0;
} }

View File

@ -33,8 +33,7 @@ fimgops: fimgops.c $(DEPS)
gcc $(COPT) $< ../libfloatimg.a -o $@ gcc $(COPT) $< ../libfloatimg.a -o $@
fimgfx: fimgfx.c $(DEPS) fimgfx: fimgfx.c $(DEPS)
gcc $(COPT) $< ../libfloatimg.a \ gcc $(COPT) $< ../libfloatimg.a -lm -o $@
-ltiff -lpnglite -lcfitsio -lm -o $@
fimghalfsize: fimghalfsize.c $(DEPS) fimghalfsize: fimghalfsize.c $(DEPS)
gcc $(COPT) $< ../libfloatimg.a -lm -o $@ gcc $(COPT) $< ../libfloatimg.a -lm -o $@

View File

@ -40,10 +40,8 @@ ne sont gérés que de façon très rudimentaire.
## fimg2text ## fimg2text
Nouveau de l'année 2020+1 : exfiltrer toutes des données d'une image flottante Nouveau de l'année 2020+1 : exfiltrer toutes des données d'une image flottante
afin de les rendre machinables. Voir aussi *fimgmetadata*. afin de les rendre machinables.
## fimgmetadata ## fimgmetadata
Nouveau avril 2022. Need more doc... Nouveau avril 2022. Need more doc...
Voir aussi *fimg2text*.

View File

@ -6,18 +6,8 @@
# ----------------------------------------------------- # -----------------------------------------------------
TMPF="bar.fimg" TMPF="../funcs/in.fimg"
# -----------------------------------------------------
function essai_metadata
{
echo " ____ essai metadata ________"
./mkfimg -v -m -t hdeg $TMPF 800 600
echo ; echo
./fimgstats $TMPF
echo ; echo
./fimgmetadata all $TMPF
}
# ----------------------------------------------------- # -----------------------------------------------------
function essai_rot90 function essai_rot90
{ {
@ -63,6 +53,6 @@ function essai_hilight
} }
# ----------------------------------------------------- # -----------------------------------------------------
essai_metadata essai_hilight
# ----------------------------------------------------- # -----------------------------------------------------

View File

@ -262,8 +262,8 @@ switch (action) {
} }
foo = fimg_export_picture(&dest, dstfname, 0); // foo = fimg_export_picture(&dest, dstfname, 0);
// foo = fimg_dump_to_file(&dest, dstfname, 0); foo = fimg_dump_to_file(&dest, dstfname, 0);
if (foo) { if (foo) {
fprintf(stderr, "dumping datas to file '%s' give us a %d\n", fprintf(stderr, "dumping datas to file '%s' give us a %d\n",
dstfname, foo); dstfname, foo);

View File

@ -73,7 +73,7 @@ action = lookup_cmd(command);
switch(action) { switch(action) {
case C_timestamp: case C_timestamp:
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break; printf("ts %ld\n", 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:

View File

@ -10,6 +10,7 @@
#include "../floatimg.h" #include "../floatimg.h"
int verbosity; /* global */ int verbosity; /* global */
int make_csv; int make_csv;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -107,9 +108,6 @@ fputs( "usage : fimgstats [options] file.fimg\n"
"\t-c\tmake a machinable csv\n" "\t-c\tmake a machinable csv\n"
"\t-v\tincrease verbosity\n" "\t-v\tincrease verbosity\n"
, stderr); , stderr);
if (k) {
fimg_print_version(k);
}
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])

View File

@ -181,7 +181,7 @@ switch(type) {
if (wrmdata) { if (wrmdata) {
// fprintf(stderr, "%s: warning, metadata is bogus\n", argv[0]); // fprintf(stderr, "%s: warning, metadata is bogus\n", argv[0]);
(void)fimg_default_metadata(&metadata, 9); (void)fimg_default_metadata(&metadata);
sprintf(metadata.idcam, "mkfimg (libv %d)", FIMG_VERSION); sprintf(metadata.idcam, "mkfimg (libv %d)", FIMG_VERSION);
foo = fimg_dumpmd_to_file(&fimg, fname, &metadata, 0); foo = fimg_dumpmd_to_file(&fimg, fname, &metadata, 0);
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -2,24 +2,11 @@
# ----------------------------------------------------- # -----------------------------------------------------
FIMG="bar.fimg" TMPF="tmp.fimg"
CAM="/dev/video0" CAM="/dev/video0"
clear # -----------------------------------------------------
# ----------------------------------------------------- ./grabvidseq -d $CAM -n 10000 -vv -p 0 -r 90
SEQ=" -n 60 -p 0 "
./grabvidseq -vv -m -d $CAM $SEQ -o $FIMG
echo ; echo ================= STATS ======================
../tools/fimgstats -v $FIMG
exit
echo
echo ================ METADATA ====================
../tools/fimgmetadata -v timestamp $FIMG
echo
../tools/fimgmetadata -v all $FIMG
# ----------------------------------------------------- # -----------------------------------------------------

View File

@ -80,7 +80,6 @@ if (verbosity) {
puts("options :"); puts("options :");
puts("\t-d /dev/?\tselect video device"); puts("\t-d /dev/?\tselect video device");
puts("\t-g\t\tconvert to gray"); puts("\t-g\t\tconvert to gray");
puts("\t-m\t\ttry to add metadata");
puts("\t-n NNN\t\thow many frames ?"); puts("\t-n NNN\t\thow many frames ?");
puts("\t-O ./\t\tset Output dir"); puts("\t-O ./\t\tset Output dir");
puts("\t-o bla.xxx\tset output filename"); puts("\t-o bla.xxx\tset output filename");
@ -91,7 +90,7 @@ puts("\t-c mode\t\tcontrast enhancement");
puts("\t-u\t\ttry upscaling..."); puts("\t-u\t\ttry upscaling...");
puts("\t-v\t\tincrease verbosity"); puts("\t-v\t\tincrease verbosity");
puts("\t-Z\t\tenable systrace"); puts("\t-Z\t\tenable systrace");
if (verbosity > 1) { if (verbosity) {
puts("\n\t\tXXX list all the contrast modes, please\n"); puts("\n\t\tXXX list all the contrast modes, please\n");
} }
exit(0); exit(0);
@ -126,15 +125,13 @@ int upscaling = 0;
int contrast = CONTRAST_NONE; int contrast = CONTRAST_NONE;
int rotfactor = 0; /* only 0 or 90 here */ int rotfactor = 0; /* only 0 or 90 here */
char *dest_dir = "."; /* no trailing slash */ char *dest_dir = "."; /* no trailing slash */
char *outfile = "out.fimg"; char *outfile = "out.pnm";
int add_metadata = 0;
FimgMetaData metadata;
#if SAVE_AS_CUMUL #if SAVE_AS_CUMUL
FloatImg cumul, tmpfimg, *to_save; FloatImg cumul, tmpfimg, *to_save;
#endif #endif
while ((opt = getopt(argc, argv, "c:d:ghmn:o:O:p:r:s:uvZ")) != -1) { while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uvZ")) != -1) {
switch(opt) { switch(opt) {
case 'c': contrast = fimg_id_contraste(optarg); case 'c': contrast = fimg_id_contraste(optarg);
if (contrast < 0) { if (contrast < 0) {
@ -145,7 +142,6 @@ while ((opt = getopt(argc, argv, "c:d:ghmn:o:O:p:r:s:uvZ")) != -1) {
case 'd': dev_name = optarg; break; case 'd': dev_name = optarg; break;
case 'g': to_gray = 1; break; case 'g': to_gray = 1; break;
case 'h': help(0); break; case 'h': help(0); break;
case 'm': add_metadata++; break;
case 'n': nbre_capt = atoi(optarg); break; case 'n': nbre_capt = atoi(optarg); break;
case 'O': dest_dir = optarg; break; case 'O': dest_dir = optarg; break;
case 'o': outfile = optarg; break; case 'o': outfile = optarg; break;
@ -390,21 +386,11 @@ if (90 == rotfactor) {
to_save = &tmpfimg; to_save = &tmpfimg;
} }
foo = format_from_extension(outfile); foo = format_from_extension(outfile);
switch (foo) { switch (foo) {
case FILE_TYPE_FIMG: 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);
foo = fimg_dumpmd_to_file(to_save, outfile, \
&metadata, 0);
}
else {
foo = fimg_dump_to_file(to_save, outfile, 0); foo = fimg_dump_to_file(to_save, outfile, 0);
}
break; break;
case FILE_TYPE_PNM: case FILE_TYPE_PNM:
foo = fimg_save_as_pnm(to_save, outfile, 1); foo = fimg_save_as_pnm(to_save, outfile, 1);