Compare commits
5 Commits
4dcc524fc4
...
e224ab83b6
Author | SHA1 | Date | |
---|---|---|---|
|
e224ab83b6 | ||
|
3c551b6c7c | ||
|
fe9a14e2b5 | ||
|
11082c0d08 | ||
|
615321eca8 |
@ -212,6 +212,20 @@ ret = fimg_decomp_rgbz_color(img, &tmp, k);
|
||||
fimg_copy_data(&tmp, img);
|
||||
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;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
@ -424,6 +438,11 @@ switch (idFx) {
|
||||
retval = fimg_highlight_color(image, image, 'R', 1.717);
|
||||
break;
|
||||
|
||||
case CR_gr2popcol:
|
||||
// fprintf(stderr, "******* TO BE DONE ********\n");
|
||||
retval = run_gr2popcol(image, -1);
|
||||
break;
|
||||
|
||||
default :
|
||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||
__func__, idFx);
|
||||
|
@ -41,5 +41,6 @@
|
||||
49 splitlevel 1 1
|
||||
50 decrgbzc 1 99
|
||||
51 decrgbzg 1 99
|
||||
60 gr2popcol 1 99
|
||||
99 message 1 1.0
|
||||
-1 end 1 1.0
|
||||
|
@ -21,6 +21,42 @@
|
||||
*/
|
||||
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 !
|
||||
|
@ -3,6 +3,8 @@
|
||||
* ---------------------------------------------------
|
||||
*/
|
||||
|
||||
int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k);
|
||||
|
||||
int incrustation_vignette(FloatImg *src, FloatImg *dst, int k);
|
||||
|
||||
|
||||
|
10
Fonderie/t.c
10
Fonderie/t.c
@ -166,19 +166,19 @@ int experiment(void)
|
||||
int foo;
|
||||
FloatImg image, dest;
|
||||
|
||||
fprintf(stderr, "EXPERIMENT\n");
|
||||
fprintf(stderr, "--------- EXPERIMENT ------------\n");
|
||||
|
||||
foo = fimg_create_from_dump("01137.fimg", &image);
|
||||
foo = fimg_create_from_dump("mire.fimg", &image);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s: err %d on create_from_dump\n",
|
||||
__func__, foo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
foo = fimg_clone(&image, &dest, 1);
|
||||
foo = fimg_copy_data(&image, &dest);
|
||||
foo = fimg_clone(&image, &dest, 0);
|
||||
|
||||
incrustation_vignette(&image, &dest, 0);
|
||||
foo = graylevel2popcolors(&image, &dest, 0);
|
||||
fprintf(stderr, "POP COLOR- -> %d\n", foo);
|
||||
|
||||
fimg_export_picture(&dest, "foo.png", 0);
|
||||
|
||||
|
11
floatimg.h
11
floatimg.h
@ -5,7 +5,7 @@
|
||||
* https://git.tetalab.org/tTh/FloatImg
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION (182)
|
||||
#define FIMG_VERSION (187)
|
||||
#define RELEASE_NAME ("noname")
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -45,7 +45,9 @@ typedef struct {
|
||||
|
||||
} 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
|
||||
@ -187,6 +189,9 @@ int fimg_mix_rgb_gray(FloatImg *img, float mix);
|
||||
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
|
||||
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 */
|
||||
int fimg_prototype_plasma(FloatImg *img, double time, int type);
|
||||
|
||||
@ -233,7 +238,7 @@ int fimg_create_from_dump(char *fname, FloatImg *head);
|
||||
|
||||
/* FIMG metadata module */
|
||||
int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused);
|
||||
int fimg_default_metadata(FimgMetaData *pmd);
|
||||
int fimg_default_metadata(FimgMetaData *pmd, int bla);
|
||||
int fimg_get_metadata_from_file(char *fname, FimgMetaData *pmd);
|
||||
|
||||
int fimg_save_R_as_fits(FloatImg *src, char *outname, int flags);
|
||||
|
@ -9,6 +9,7 @@ DEPS = ../floatimg.h Makefile
|
||||
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
|
||||
fimg-libpnm.o rampes.o rectangle.o \
|
||||
sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \
|
||||
falsecolors.o \
|
||||
geometry.o rotate.o fimg-openexr.o \
|
||||
equalize.o fimg-fits.o saturation.o histogram.o \
|
||||
fimg-dicom.o \
|
||||
@ -137,6 +138,9 @@ qsortrgb.o: qsortrgb.c $(DEPS)
|
||||
exporter.o: exporter.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
falsecolors.o: falsecolors.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
|
||||
hsv.o: hsv.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
39
funcs/falsecolors.c
Normal file
39
funcs/falsecolors.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
10
funcs/t.c
10
funcs/t.c
@ -25,7 +25,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
||||
Geometrie, FileType, Mirror, KillRGB,
|
||||
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
|
||||
Rectangle, Dicom };
|
||||
Rectangle, Dicom, Fakolor0, Fakolor3 };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@ -60,6 +60,8 @@ Command commands[] = {
|
||||
{ "decomprgbg", DecompRgbg },
|
||||
{ "rectangle", Rectangle },
|
||||
{ "dicom", Dicom },
|
||||
{ "fakolor0", Fakolor0 },
|
||||
{ "fakolor3", Fakolor3 },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@ -248,7 +250,9 @@ switch(opt) {
|
||||
case Dicom:
|
||||
foo = essai_dicom(filename, outfile, 0);
|
||||
break;
|
||||
|
||||
case Fakolor0:
|
||||
foo = essai_0_fausses_couleurs(outfile, 0);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
exit(1);
|
||||
@ -256,7 +260,7 @@ switch(opt) {
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
fprintf(stderr, "******* Essai --> %d\n", foo);
|
||||
fprintf(stderr, "******* essai --> %d\n\n", foo);
|
||||
}
|
||||
|
||||
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid());
|
||||
|
@ -18,6 +18,26 @@
|
||||
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)
|
||||
{
|
||||
@ -41,6 +61,10 @@ FloatImg img;
|
||||
int foo;
|
||||
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);
|
||||
|
||||
fimg_drand48(&img, 1.0);
|
||||
@ -741,6 +765,10 @@ int essai_geometrie(char *infile, int notused)
|
||||
FloatImg fimg, result;
|
||||
int foo;
|
||||
|
||||
if (0 != notused) {
|
||||
fprintf(stderr, "in %s, k must be 0, was %d\n", __func__, notused);
|
||||
}
|
||||
|
||||
if (NULL != infile) {
|
||||
fprintf(stderr, "loading %s\n", infile);
|
||||
foo = fimg_create_from_dump(infile, &fimg);
|
||||
@ -879,13 +907,17 @@ int essai_mire(char *outname, int notused)
|
||||
FloatImg fimg;
|
||||
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);
|
||||
|
||||
re = fimg_test_pattern(&fimg, 9, 1.0);
|
||||
if (re) {
|
||||
fprintf(stderr, "fimg_test_pattern -> %d\n", re);
|
||||
}
|
||||
foo = fimg_export_picture(&fimg, "mire.pnm", 0);
|
||||
foo = fimg_export_picture(&fimg, outname, 0);
|
||||
fprintf(stderr, "in %s, export give a %d value\n", __func__, foo);
|
||||
|
||||
return 0;
|
||||
|
@ -28,6 +28,7 @@ int essai_geometrie(char *infile, int notused);
|
||||
int essai_detect_type(void);
|
||||
int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
|
||||
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);
|
||||
|
||||
|
@ -48,7 +48,7 @@ if (memcmp(filehead.magic, "FIMG", 4)) {
|
||||
|
||||
/* XXX preparer la gestion des metadata */
|
||||
if ('a' == filehead.magic[4]) {
|
||||
fprintf(stderr,"****** %s have metadata\n", fname);
|
||||
fprintf(stderr,"\n\t****** %s have metadata\n\n", fname);
|
||||
}
|
||||
|
||||
datas[0] = filehead.w;
|
||||
@ -67,6 +67,7 @@ int fimg_dumpmd_to_file(FloatImg *fimg, char *fname, \
|
||||
FILE *fp;
|
||||
int foo, nbre;
|
||||
FimgFileHead filehead;
|
||||
FimgMetaData fakemd;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p '%s' %p %d )\n", __func__, fimg,
|
||||
@ -83,6 +84,20 @@ if (FIMG_TYPE_RGB != fimg->type) {
|
||||
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");
|
||||
if (NULL==fp) {
|
||||
perror(fname);
|
||||
@ -96,7 +111,7 @@ filehead.t = fimg->type;
|
||||
|
||||
/* XXX metadata */
|
||||
if (NULL != pmd) {
|
||||
|
||||
fprintf(stderr, "ok, %s give an 'a' flag\n", __func__);
|
||||
filehead.magic[4] = 'a';
|
||||
}
|
||||
|
||||
@ -108,8 +123,9 @@ if (1 != foo) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* XXX metadata */
|
||||
/* we have metadata, put them on tape */
|
||||
if (NULL != pmd) {
|
||||
fprintf(stderr, ">>> %s write metadata %p\n", __func__, pmd);
|
||||
foo = fwrite(pmd, sizeof(FimgMetaData), 1, fp);
|
||||
if (1 != foo) {
|
||||
perror(fname);
|
||||
@ -236,6 +252,12 @@ if ( (filehead.w != where->width) ||
|
||||
/* XXX preparer la gestion des metadata */
|
||||
if ('a' == filehead.magic[4]) {
|
||||
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 */
|
||||
@ -274,7 +296,7 @@ fprintf(stderr, ">>> %-25s ( '%s' %p )\n", __func__, fname, head);
|
||||
|
||||
/*
|
||||
* may be we can crash coredump here if the head
|
||||
* descriptor is not blank ?
|
||||
* descriptor from calleris not blank ?
|
||||
*/
|
||||
|
||||
fp = fopen(fname, "r");
|
||||
@ -301,6 +323,19 @@ if (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;
|
||||
nbread = 0;
|
||||
nbread += fread(head->R, sizeof(float), size, fp);
|
||||
|
@ -37,6 +37,10 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
|
||||
pmd, title, notused);
|
||||
#endif
|
||||
|
||||
if (NULL != title) {
|
||||
fprintf(stderr, "==== metadate for %s\n", title);
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "sizeof(metadata) = %ld\n", \
|
||||
sizeof(FimgMetaData));
|
||||
@ -49,8 +53,8 @@ doubletime = (double)pmd->timestamp.tv_sec + \
|
||||
(double)pmd->timestamp.tv_usec / 1e6;
|
||||
fprintf(stderr, "dtime of day = %e\n", doubletime);
|
||||
fprintf(stderr, "creator pid = %ld\n", pmd->cpid);
|
||||
fprintf(stderr, "counter = %d\n", pmd->count);
|
||||
fprintf(stderr, "float value = %.3f\n", pmd->fval);
|
||||
fprintf(stderr, "counter = %d\n", pmd->count);
|
||||
fprintf(stderr, "id camera = '%s'\n", pmd->idcam);
|
||||
fprintf(stderr, "origin = 0x%x\n", pmd->origin);
|
||||
|
||||
@ -63,7 +67,7 @@ fputc('\n', stderr);
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
int fimg_default_metadata(FimgMetaData *pmd)
|
||||
int fimg_default_metadata(FimgMetaData *pmd, int bla)
|
||||
{
|
||||
int foo;
|
||||
struct timeval tvl;
|
||||
@ -80,18 +84,20 @@ if (foo) {
|
||||
perror("omg");
|
||||
}
|
||||
else {
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "Time of day %12ld %12ld\n", \
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, " set TimeOfDay to %12ld , %8ld\n", \
|
||||
tvl.tv_sec, tvl.tv_usec);
|
||||
}
|
||||
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
pmd->cpid = getpid();
|
||||
pmd->count = 0;
|
||||
pmd->fval = 255.0;
|
||||
strcpy(pmd->idcam, "<unknow>");
|
||||
pmd->origin = 0xdeadbeef;
|
||||
pmd->cpid = getpid(); // we are the creator, no ?
|
||||
pmd->count = 1; // mmmm...
|
||||
pmd->fval = 255.0; // Ok
|
||||
strcpy(pmd->idcam, "<noname>");
|
||||
pmd->origin = 0xdeadbeef; // classic joke, sorry
|
||||
pmd->reserved[0] = bla;
|
||||
pmd->reserved[7] = 0x55445544; // magic number is a crime
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,7 +33,8 @@ fimgops: fimgops.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -o $@
|
||||
|
||||
fimgfx: fimgfx.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
|
||||
gcc $(COPT) $< ../libfloatimg.a \
|
||||
-ltiff -lpnglite -lcfitsio -lm -o $@
|
||||
|
||||
fimghalfsize: fimghalfsize.c $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -lm -o $@
|
||||
|
@ -40,8 +40,10 @@ ne sont gérés que de façon très rudimentaire.
|
||||
## fimg2text
|
||||
|
||||
Nouveau de l'année 2020+1 : exfiltrer toutes des données d'une image flottante
|
||||
afin de les rendre machinables.
|
||||
afin de les rendre machinables. Voir aussi *fimgmetadata*.
|
||||
|
||||
## fimgmetadata
|
||||
|
||||
Nouveau avril 2022. Need more doc...
|
||||
Voir aussi *fimg2text*.
|
||||
|
||||
|
@ -6,8 +6,18 @@
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
TMPF="../funcs/in.fimg"
|
||||
TMPF="bar.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
|
||||
{
|
||||
@ -53,6 +63,6 @@ function essai_hilight
|
||||
}
|
||||
# -----------------------------------------------------
|
||||
|
||||
essai_hilight
|
||||
essai_metadata
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
@ -262,8 +262,8 @@ switch (action) {
|
||||
|
||||
}
|
||||
|
||||
// foo = fimg_export_picture(&dest, dstfname, 0);
|
||||
foo = fimg_dump_to_file(&dest, dstfname, 0);
|
||||
foo = fimg_export_picture(&dest, dstfname, 0);
|
||||
// foo = fimg_dump_to_file(&dest, dstfname, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "dumping datas to file '%s' give us a %d\n",
|
||||
dstfname, foo);
|
||||
|
@ -73,7 +73,7 @@ action = lookup_cmd(command);
|
||||
|
||||
switch(action) {
|
||||
case C_timestamp:
|
||||
printf("ts %ld\n", metadata.timestamp.tv_sec); break;
|
||||
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
|
||||
case C_count:
|
||||
printf("count %d\n", metadata.count); break;
|
||||
case C_fval:
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "../floatimg.h"
|
||||
|
||||
int verbosity; /* global */
|
||||
|
||||
int make_csv;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
@ -108,6 +107,9 @@ fputs( "usage : fimgstats [options] file.fimg\n"
|
||||
"\t-c\tmake a machinable csv\n"
|
||||
"\t-v\tincrease verbosity\n"
|
||||
, stderr);
|
||||
if (k) {
|
||||
fimg_print_version(k);
|
||||
}
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -181,7 +181,7 @@ switch(type) {
|
||||
|
||||
if (wrmdata) {
|
||||
// fprintf(stderr, "%s: warning, metadata is bogus\n", argv[0]);
|
||||
(void)fimg_default_metadata(&metadata);
|
||||
(void)fimg_default_metadata(&metadata, 9);
|
||||
sprintf(metadata.idcam, "mkfimg (libv %d)", FIMG_VERSION);
|
||||
foo = fimg_dumpmd_to_file(&fimg, fname, &metadata, 0);
|
||||
#if DEBUG_LEVEL
|
||||
|
@ -2,11 +2,24 @@
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
TMPF="tmp.fimg"
|
||||
FIMG="bar.fimg"
|
||||
CAM="/dev/video0"
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
||||
./grabvidseq -d $CAM -n 10000 -vv -p 0 -r 90
|
||||
clear
|
||||
|
||||
# -----------------------------------------------------
|
||||
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
|
||||
|
||||
# -----------------------------------------------------
|
||||
|
@ -80,6 +80,7 @@ if (verbosity) {
|
||||
puts("options :");
|
||||
puts("\t-d /dev/?\tselect video device");
|
||||
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-O ./\t\tset Output dir");
|
||||
puts("\t-o bla.xxx\tset output filename");
|
||||
@ -90,7 +91,7 @@ puts("\t-c mode\t\tcontrast enhancement");
|
||||
puts("\t-u\t\ttry upscaling...");
|
||||
puts("\t-v\t\tincrease verbosity");
|
||||
puts("\t-Z\t\tenable systrace");
|
||||
if (verbosity) {
|
||||
if (verbosity > 1) {
|
||||
puts("\n\t\tXXX list all the contrast modes, please\n");
|
||||
}
|
||||
exit(0);
|
||||
@ -125,13 +126,15 @@ int upscaling = 0;
|
||||
int contrast = CONTRAST_NONE;
|
||||
int rotfactor = 0; /* only 0 or 90 here */
|
||||
char *dest_dir = "."; /* no trailing slash */
|
||||
char *outfile = "out.pnm";
|
||||
char *outfile = "out.fimg";
|
||||
int add_metadata = 0;
|
||||
FimgMetaData metadata;
|
||||
|
||||
#if SAVE_AS_CUMUL
|
||||
FloatImg cumul, tmpfimg, *to_save;
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uvZ")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "c:d:ghmn:o:O:p:r:s:uvZ")) != -1) {
|
||||
switch(opt) {
|
||||
case 'c': contrast = fimg_id_contraste(optarg);
|
||||
if (contrast < 0) {
|
||||
@ -142,6 +145,7 @@ while ((opt = getopt(argc, argv, "c:d:ghn:o:O:p:r:s:uvZ")) != -1) {
|
||||
case 'd': dev_name = optarg; break;
|
||||
case 'g': to_gray = 1; break;
|
||||
case 'h': help(0); break;
|
||||
case 'm': add_metadata++; break;
|
||||
case 'n': nbre_capt = atoi(optarg); break;
|
||||
case 'O': dest_dir = optarg; break;
|
||||
case 'o': outfile = optarg; break;
|
||||
@ -386,11 +390,21 @@ if (90 == rotfactor) {
|
||||
to_save = &tmpfimg;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
foo = fimg_dumpmd_to_file(to_save, outfile, \
|
||||
&metadata, 0);
|
||||
}
|
||||
else {
|
||||
foo = fimg_dump_to_file(to_save, outfile, 0);
|
||||
}
|
||||
break;
|
||||
case FILE_TYPE_PNM:
|
||||
foo = fimg_save_as_pnm(to_save, outfile, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user