Compare commits

..

6 Commits

Author SHA1 Message Date
tTh
63674c8eee good job, captain refactor 2022-11-07 12:48:21 +01:00
tTh
be4b6a774e added #include <stdint.h> 2022-11-07 12:39:07 +01:00
tTh
d750c027fa a little cleanup 2022-11-05 21:00:14 +01:00
tTh
7f3912a133 mollyguard & debug msg 2022-11-03 02:58:14 +01:00
tTh
1f4b424be7 cosmetic 2022-11-02 22:11:54 +01:00
tTh
d49b77a79f morpho0 filter in fimgfx 2022-11-01 21:18:09 +01:00
8 changed files with 67 additions and 38 deletions

22
.gitignore vendored
View File

@ -54,23 +54,6 @@ v4l2/*.tiff
v4l2/video-infos
v4l2/nc-camcontrol
tools/fimg2png
tools/fimg2pnm
tools/fimg2tiff
tools/fimg2fits
tools/fimg2text
tools/fimgstats
tools/fimghalfsize
tools/mkfimg
tools/png2fimg
tools/addtga2fimg
tools/addpnm2fimg
tools/cumulfimgs
tools/fimgops
tools/fimgfx
tools/fimgmetadata
tools/*.png
tools/*.tiff
Fonderie/*.o
Fonderie/*.png
@ -93,8 +76,3 @@ experiment/muxplanes
experiment/movepixels
experiment/tcache
contrib/fimg2povhf
contrib/*.tga
contrib/pov.stderr
contrib/*.png
contrib/*.gif

9
contrib/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
fimg2povhf
demo_fmorph
*.tga
*.png
*.pnm
*.fimg
pov.stderr

View File

@ -20,11 +20,11 @@
* https://git.tetalab.org/tTh/FloatImg
*/
#define FIMG_VERSION (205)
#define FIMG_VERSION (208)
#define RELEASE_NAME ("noname")
/* XXX add a test for stdint.h / uint32_t XXX */
#include <stdint.h>
/*
* in memory descriptor of a floating image
*/

View File

@ -40,7 +40,7 @@ typedef struct
static fpixel pixels[9];
/* --------------------------------------------------------------------- !*/
static int comparaison(const void *A, const void *B)
static int comparaison_fgris(const void *A, const void *B)
{
return ((fpixel *)A)->fgris > ((fpixel *)B)->fgris;
}
@ -52,11 +52,11 @@ int fimg_filtre_morpho_0(FloatImg *sfimg, FloatImg *dfimg, int index)
{
int xs, ys, loop9;
int xp, yp;
float rgb[3], fval;
float rgb[3];
#if DEBUG_LEVEL
// #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, sfimg, dfimg, index);
#endif
// #endif
if ( (index<0) || (index>8)) {
fprintf(stderr, " %s: bad index %d\n", __func__, index);
@ -77,7 +77,7 @@ for (ys=1; ys<sfimg->height-1; ys++) {
pixels[loop9].fgris = rgb[0];
pixels[loop9].rang = loop9;
}
qsort(&pixels, 9, sizeof(fpixel), comparaison);
qsort(&pixels, 9, sizeof(fpixel), comparaison_fgris);
rgb[0] = rgb[1] = rgb[2] = pixels[index].fgris;
fimg_put_rgb(dfimg, xs, ys, rgb);
}

View File

@ -108,6 +108,12 @@ return -1;
/* --------------------------------------------------------------------- */
int print_rectangle(char *str, FimgArea51 *rect)
{
if (MAGIC_AREA51 != rect->magic) {
fprintf(stderr, "%s: bad magic number 0x%08X\n", __func__,
rect->magic);
return -666;
}
printf("rect @ %p '%s' :\n\t %dx%d at %d,%d\n", rect, str,
rect->w, rect->h, rect->x, rect->y);
return 0;
@ -120,22 +126,26 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused)
{
int x, y, w, h, foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %s %p %d )\n", __func__, str, r, notused);
#endif
if (notused) {
fprintf(stderr, "notused was %d, must be 0 in %s\n",
notused, __func__);
}
if (verbosity)
fprintf(stderr, "parsing %s\n", str);
notused, __func__); }
if (verbosity > 1) fprintf(stderr, "parsing '%s'\n", str);
foo = sscanf(str, "%d,%d,%d,%d", &w, &h, &x, &y);
if (4 == foo) {
r->x = x, r->y = y, r->w = w, r->h = h;
r->magic = MAGIC_AREA51;
return 4;
}
r->magic = 0xBAD;
return -1;
}
/* --------------------------------------------------------------------- */
int format_from_extension(char *fname)
{

21
tools/.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
fimg2png
fimgextract
fimg2pnm
fimg2tiff
fimg2fits
fimg2text
fimgstats
fimghalfsize
mkfimg
png2fimg
addtga2fimg
addpnm2fimg
cumulfimgs
fimgops
fimgfx
fimgmetadata
*.png
*.tiff

View File

@ -28,7 +28,8 @@ 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_fakol0, Fx_fakol3,
Fx_morph0, Fx_morph4, Fx_morph8 };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 },
@ -53,6 +54,9 @@ Fx fx_list[] = {
{ "abs", Fx_absolute, 0, 1 },
{ "clamp", Fx_clamp, 0, 1 },
{ "fakol0", Fx_fakol0, 0, 1 },
{ "morph0", Fx_morph0, 0, 1 },
{ "morph4", Fx_morph4, 0, 1 },
{ "morph8", Fx_morph8, 0, 1 },
{ NULL, 0, 0, 0 }
};
@ -261,6 +265,13 @@ switch (action) {
foo = fimg_falsecolors_0(&src, &dest, 0, 1.0);
break;
case Fx_morph0:
foo = fimg_filtre_morpho_0(&src, &dest, 0); break;
case Fx_morph4:
foo = fimg_filtre_morpho_0(&src, &dest, 4); break;
case Fx_morph8:
foo = fimg_filtre_morpho_0(&src, &dest, 8); break;
default:
fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action);

View File

@ -1,6 +1,6 @@
#!/bin/bash
SRC="in.fimg"
SRC="../lib/quux.fimg"
K="0.414"
TMP="/tmp/foo.fimg"