Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
28698c4f60 | |||
c842ff3f54 | |||
f36984db0d | |||
3dfaff7df4 | |||
|
bbc0309591 |
115
.gitignore
vendored
115
.gitignore
vendored
@ -1,19 +1,18 @@
|
||||
|
||||
lib/*.o
|
||||
lib/t
|
||||
lib/*.fimg
|
||||
lib/*.png
|
||||
lib/*.gif
|
||||
build
|
||||
|
||||
# src/lib/*.o
|
||||
src/lib/t
|
||||
src/lib/*.fimg
|
||||
src/lib/*.png
|
||||
src/lib/*.gif
|
||||
|
||||
*.o
|
||||
*.a
|
||||
gmon.out
|
||||
|
||||
*.pnm
|
||||
*.fimg
|
||||
essai
|
||||
MANIFEST
|
||||
tarball
|
||||
|
||||
*/*.ps
|
||||
doc/*.toc
|
||||
@ -26,62 +25,62 @@ doc/*.ind
|
||||
doc/co*.tex
|
||||
doc/foo.html
|
||||
|
||||
funcs/t
|
||||
funcs/*.o
|
||||
funcs/*.png
|
||||
funcs/V/*
|
||||
funcs/*.gif
|
||||
funcs/*.fits
|
||||
funcs/*.tiff
|
||||
funcs/toto
|
||||
src/funcs/t
|
||||
src/funcs/*.o
|
||||
src/funcs/*.png
|
||||
src/funcs/V/*
|
||||
src/src/funcs/*.gif
|
||||
src/funcs/*.fits
|
||||
src/funcs/*.tiff
|
||||
src/funcs/toto
|
||||
|
||||
scripts/*.fimg
|
||||
scripts/*.pnm
|
||||
scripts/*.gif
|
||||
|
||||
v4l2/t
|
||||
v4l2/capture
|
||||
v4l2/grabvidseq
|
||||
v4l2/*.o
|
||||
v4l2/*.ppm
|
||||
v4l2/*.png
|
||||
v4l2/*.fits
|
||||
v4l2/*.tiff
|
||||
v4l2/video-infos
|
||||
v4l2/nc-camcontrol
|
||||
src/v4l2/t
|
||||
src/v4l2/capture
|
||||
src/v4l2/grabvidseq
|
||||
src/v4l2/*.o
|
||||
src/v4l2/*.ppm
|
||||
src/v4l2/*.png
|
||||
src/v4l2/*.fits
|
||||
src/v4l2/*.tiff
|
||||
src/v4l2/video-infos
|
||||
src/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/*.png
|
||||
tools/*.tiff
|
||||
# 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
|
||||
src/tools/*.png
|
||||
src/tools/*.tiff
|
||||
|
||||
Fonderie/*.o
|
||||
Fonderie/*.png
|
||||
Fonderie/*.pnm
|
||||
Fonderie/*.gif
|
||||
Fonderie/*.fimg
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
Fonderie/t
|
||||
Fonderie/singlepass
|
||||
Fonderie/crapdef.h
|
||||
Fonderie/crapstr.h
|
||||
extras/Fonderie/*.o
|
||||
extras/Fonderie/*.png
|
||||
extras/Fonderie/*.pnm
|
||||
extras/Fonderie/*.gif
|
||||
extras/Fonderie/*.fimg
|
||||
extras/extras/Fonderie/fonderie
|
||||
extras/Fonderie/interpolator
|
||||
extras/Fonderie/t
|
||||
extras/Fonderie/singlepass
|
||||
extras/Fonderie/crapdef.h
|
||||
extras/Fonderie/crapstr.h
|
||||
|
||||
experiment/assemblage
|
||||
experiment/extracteur
|
||||
experiment/*.fimg
|
||||
experiment/*.pnm
|
||||
experiment/*.o
|
||||
extras/experiment/assemblage
|
||||
extras/experiment/extracteur
|
||||
extras/experiment/*.fimg
|
||||
extras/experiment/*.pnm
|
||||
extras/experiment/*.o
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
|
||||
#
|
||||
# This file is the 'grandmasta' of the compilation process.
|
||||
# for now, this is juste a wip idea.
|
||||
#
|
||||
|
93
Makefile
93
Makefile
@ -1,34 +1,77 @@
|
||||
####################################################
|
||||
# Before running make, you must have #
|
||||
# a look to the 'build.sh' script ! #
|
||||
####################################################
|
||||
# CC_OPTS = -Wall -fpic -g -pg -no-pie -DDEBUG_LEVEL=0
|
||||
# LD_OPTS = libfloatimg.a -pg -lm
|
||||
|
||||
COPT = -Wall -fpic -g -pg -no-pie -DDEBUG_LEVEL=0
|
||||
LDOPT = libfloatimg.a -pg -lm
|
||||
LIB_DIR = build/lib
|
||||
|
||||
all: essai
|
||||
OBJ_DIR = build/obj
|
||||
|
||||
#---------------------------------------------------------------
|
||||
STATIC_LIB = $(LIB_DIR)/libfloatimg-lib.a
|
||||
|
||||
essai: essai.c libfloatimg.a floatimg.h Makefile
|
||||
gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
|
||||
DYN_LIB = $(LIB_DIR)/libfloatimg.so
|
||||
|
||||
#---------------------------------------------------------------
|
||||
VERBOSITY = 0
|
||||
|
||||
TOTAR = *.[ch] Makefile *.sh *.md \
|
||||
doc/the*.tex doc/mk*.sh doc/*.txt \
|
||||
funcs/*.[ch] funcs/Makefile \
|
||||
tools/*.[ch] tools/*.sh tools/README.md tools/Makefile \
|
||||
v4l2/*.[ch] v4l2/Makefile \
|
||||
scripts/*.sh scripts/README.md \
|
||||
lib/*.[ch] lib/Makefile
|
||||
all: lib funcs tools v4l2
|
||||
|
||||
lines: $(TOTAR)
|
||||
@wc $(TOTAR) | sort -n
|
||||
# shared: $(DYN_LIB)
|
||||
|
||||
tarball: $(TOTAR)
|
||||
date > tarball
|
||||
ls $(TOTAR) | sed 's/^/FloatImg\//' > MANIFEST
|
||||
( cd .. ; tar zcvf floatimg.tar.gz `cat FloatImg/MANIFEST` )
|
||||
# $(DYN_LIB): lib funcs
|
||||
|
||||
lib:
|
||||
$(MAKE) -C src/lib all
|
||||
|
||||
funcs: lib
|
||||
$(MAKE) -C src/funcs
|
||||
# link lib & funcs for shared library
|
||||
echo "int verbosity = $(VERBOSITY);" > $(OBJ_DIR)/verbosity.c
|
||||
gcc -c $(OBJ_DIR)/verbosity.c -o $(OBJ_DIR)/verbosity.o
|
||||
gcc -shared $(OBJ_DIR)/*.o -lnetpbm -lpnglite -lcfitsio -ltiff -lz -lm -o $(DYN_LIB)
|
||||
|
||||
|
||||
tools: lib
|
||||
mkdir -p build/bin
|
||||
$(MAKE) -C src/tools
|
||||
|
||||
v4l2:
|
||||
mkdir -p build/bin
|
||||
$(MAKE) -C src/v4l2
|
||||
|
||||
clean:
|
||||
$(MAKE) -C src/lib clean
|
||||
$(MAKE) -C src/funcs clean
|
||||
$(MAKE) -C src/tools clean
|
||||
$(MAKE) -C src/v4l2 clean
|
||||
rm -rf "./build"
|
||||
|
||||
install: all
|
||||
cp src/floatimg.h /usr/local/include
|
||||
cp build/lib/* /usr/local/lib
|
||||
cp build/bin/* /usr/local/bin
|
||||
|
||||
|
||||
# all: essai
|
||||
|
||||
# #---------------------------------------------------------------
|
||||
|
||||
# essai: essai.c libfloatimg.a floatimg.h Makefile
|
||||
# gcc $(COPT) $< $(LDOPT) -lpnglite -lz -o $@
|
||||
|
||||
# #---------------------------------------------------------------
|
||||
|
||||
# TOTAR = *.[ch] Makefile *.sh *.md \
|
||||
# doc/the*.tex doc/mk*.sh doc/*.txt \
|
||||
# funcs/*.[ch] funcs/Makefile \
|
||||
# tools/*.[ch] tools/*.sh tools/README.md tools/Makefile \
|
||||
# v4l2/*.[ch] v4l2/Makefile \
|
||||
# scripts/*.sh scripts/README.md \
|
||||
# lib/*.[ch] lib/Makefile
|
||||
|
||||
# lines: $(TOTAR)
|
||||
# @wc $(TOTAR) | sort -n
|
||||
|
||||
# tarball: $(TOTAR)
|
||||
# date > tarball
|
||||
# ls $(TOTAR) | sed 's/^/FloatImg\//' > MANIFEST
|
||||
# ( cd .. ; tar zcvf floatimg.tar.gz `cat FloatImg/MANIFEST` )
|
||||
# #---------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------
|
||||
|
25
README.md
25
README.md
@ -1,3 +1,14 @@
|
||||
# FloatImg4PythonBinding
|
||||
|
||||
Un fork de la galactique bibliothèque FloatImg de tTh, réaménagé pour permettre une utilisation depuis Python avec l'embryonnaire binding https://git.tetalab.org/Mutah/python-FloatImg/ (seulement sur la branche develop pour le moment)
|
||||
|
||||
Pas de révolution mais :
|
||||
|
||||
- production d'une bibliothèque partagée
|
||||
- arborescence remanié : les meubles ont changés de place : les sources sont dans `src`, les expérimentations dans `extra` et les binaires sont produits dans `build`
|
||||
- build system : un Makefile racine avec des cibles générales : `all` pour tout builder, `lib` pour la bibliothèque de base, `funcs`
|
||||
|
||||
|
||||
# Traitement des images en virgule flottante.
|
||||
|
||||
C'est d"abord un ensemble de fonctions pour traiter des images avec une énorme dynamique
|
||||
@ -30,15 +41,17 @@ Bien entendu, avant tout, il faut installer quelques outils et
|
||||
dépendances. Je vais tenter de les lister dans le plus grand
|
||||
désordre (à la sauce Debian) :
|
||||
|
||||
```bash
|
||||
sudo apt install libtiff-dev libpnglite-dev liblo-dev libv4l2-dev libcfitsio-dev libnetpbm-dev
|
||||
```
|
||||
apt install libtiff-dev
|
||||
apt install libpnglite-dev
|
||||
apt install liblo-dev
|
||||
apt install libv4l2-dev
|
||||
apt install libcfitsio-dev
|
||||
apt install libnetpbm-dev
|
||||
|
||||
Sauce Ubuntu :
|
||||
|
||||
```bash
|
||||
sudo apt install libtiff-dev libpnglite-dev liblo-dev libv4l-dev libcfitsio-dev libnetpbm10-dev libncurses5-dev
|
||||
```
|
||||
|
||||
|
||||
Certains outils externes sont aussi utiles :
|
||||
|
||||
- gnuplot
|
||||
|
39
build.sh
39
build.sh
@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
function build
|
||||
{
|
||||
echo ============= $1 ==============
|
||||
curdir=${PWD}
|
||||
cd $1
|
||||
make
|
||||
error=$?
|
||||
cd ${curdir}
|
||||
|
||||
if [ ${error} -ne 0 ]
|
||||
then
|
||||
echo === error on $1 = ${error}
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
build lib
|
||||
build funcs
|
||||
build tools
|
||||
build v4l2
|
||||
build Fonderie
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
|
||||
make
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* http://la.buvette.org/photos/cumul
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 145
|
||||
#define FIMG_VERSION 150
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -26,7 +26,7 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
char magic[8];
|
||||
int w, h, t;
|
||||
int32_t w, h, t;
|
||||
} FimgFileHead;
|
||||
|
||||
#define MAGIC_AREA51 0xA5EA0051
|
||||
@ -95,7 +95,6 @@ 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 {
|
||||
@ -124,6 +123,9 @@ int fimg_highlight_color(FloatImg *src, FloatImg *dst,
|
||||
int fimg_binarize(FloatImg *pimg, int notused);
|
||||
int fimg_trinarize(FloatImg *pimg, int notused);
|
||||
|
||||
/* module sfx4.c */
|
||||
int fimg_sfx_triplemul(FloatImg *s, FloatImg *d, int notused);
|
||||
|
||||
/* funcs/rotate.c module */
|
||||
/* #coronamaison */
|
||||
int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused);
|
||||
@ -218,6 +220,7 @@ int fimg_save_as_bmp(FloatImg *src, char *outname, int flags);
|
||||
|
||||
int fimg_test_pattern(FloatImg *fimg, int type, double dval);
|
||||
int fimg_draw_something(FloatImg *fimg);
|
||||
int fimg_mircol_1(FloatImg *dst, float mval);
|
||||
int fimg_multirandom(FloatImg *fimg, long nbpass);
|
||||
|
||||
/* file is 'funcs/utils.c' */
|
@ -2,18 +2,28 @@
|
||||
|
||||
# Please, use the 'Gloabl.makefile' system !
|
||||
|
||||
LIB_DIR = ../../build/lib
|
||||
|
||||
OBJ_DIR = ../../build/obj
|
||||
|
||||
STATIC_LIB = $(LIB_DIR)/libfloatimg.a
|
||||
|
||||
DYN_OBJ = $(OBJ_DIR)/libfloatimg-funcs.o
|
||||
|
||||
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
|
||||
|
||||
DEPS = ../floatimg.h Makefile
|
||||
|
||||
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
|
||||
fimg-libpnm.o rampes.o sfx0.o sfx1.o sfx2.o \
|
||||
fimg-libpnm.o rampes.o sfx0.o sfx1.o sfx2.o sfx4.o \
|
||||
geometry.o rotate.o fimg-openexr.o \
|
||||
equalize.o fimg-fits.o saturation.o histogram.o \
|
||||
hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \
|
||||
displacement.o dithering.o plasmas.o incrustator.o \
|
||||
recurse.o
|
||||
|
||||
|
||||
all: $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
|
||||
#---------------------------------------------------------------
|
||||
|
||||
t: t.c $(DEPS) ../libfloatimg.a tests.o
|
||||
@ -31,10 +41,16 @@ tests.o: tests.c tests.h $(DEPS)
|
||||
#---------------------------------------------------------------
|
||||
# upper-level functions
|
||||
|
||||
../libfloatimg.a: $(OBJS)
|
||||
$(STATIC_LIB): $(OBJS)
|
||||
$(AR) r $@ $?
|
||||
|
||||
# ###
|
||||
|
||||
$(DYN_OBJ): $(OBJS)
|
||||
mkdir -p $(OBJ_DIR)
|
||||
ld -Ur -o $@ $?
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
|
||||
|
||||
recurse.o: recurse.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
@ -99,6 +115,9 @@ sfx1.o: sfx1.c $(DEPS)
|
||||
sfx2.o: sfx2.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
sfx4.o: sfx4.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
||||
contour2x2.o: contour2x2.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
@ -59,7 +59,7 @@ for (y=0; y<psrc->height; y++) {
|
||||
fimg_get_rgb(psrc, x, y, rgb);
|
||||
|
||||
dispx = (float)x + (rgb[1]/dltg * 20.0);
|
||||
dispy = (float)y + (rgb[2]/dltb * 10.0);
|
||||
dispy = (float)y + (rgb[2]/dltb * 20.0);
|
||||
dstx = (int)roundf(dispx - 10.0);
|
||||
dsty = (int)roundf(dispy - 10.0);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -86,6 +86,24 @@ for (y=1; y<fimg->height; y++) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_mircol_1(FloatImg *dst, float mval)
|
||||
{
|
||||
int x, y;
|
||||
float fx, fy, rgb[3];
|
||||
|
||||
for (y=0; y<dst->height; y++) {
|
||||
fy = (float)y / (float)dst->height;
|
||||
for (x=0; x<dst->width; x++) {
|
||||
fx = (float)x / (float)dst->width;
|
||||
rgb[0] = mval * fx;
|
||||
rgb[1] = mval * ((fx+fy)/2.0);
|
||||
rgb[2] = mval * fy;
|
||||
fimg_put_rgb(dst, x, y, rgb);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_multirandom(FloatImg *fimg, long nbpass)
|
||||
{
|
||||
int foo, x, y;
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
@ -20,6 +21,8 @@ int fimg_recursion_proto(FloatImg *src, FloatImg *dst, int notused)
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, notused);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "!!!!!! %s is a wip !!!!!\n", __func__);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------------- */
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
@ -99,7 +100,7 @@ coefs[0] = coefs[2] = coefs[4] = minima;
|
||||
|
||||
foo = fimg_shift_to_zero(src, dst, coefs);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s WTF?\n", __func__);
|
||||
fprintf(stderr, "%s WTF? %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
42
src/funcs/sfx4.c
Normal file
42
src/funcs/sfx4.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* FLOATIMG - a kluge from tTh
|
||||
* ---------------------------
|
||||
*
|
||||
* some strange effects on floating pictures.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------- */
|
||||
int fimg_sfx_triplemul(FloatImg *src, FloatImg *dst, int notused)
|
||||
{
|
||||
int x, y, foo;
|
||||
float in[3], out[3];
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p 0x%04x )\n", __func__, img, notused);
|
||||
#endif
|
||||
|
||||
for (y=0; y<src->height; y++) {
|
||||
for (x=0; x<src->width; x++) {
|
||||
foo = fimg_get_rgb(src, x, y, in);
|
||||
out[0] = in[1] * in[2];
|
||||
out[1] = in[0] * in[2];
|
||||
out[2] = in[0] * in[1];
|
||||
// fprintf(stderr, "%9f %9f %9f\n", out[0], out[1], out[2]);
|
||||
foo = fimg_put_rgb(dst, x, y, out);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------- */
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
@ -2,6 +2,14 @@
|
||||
# building the base library
|
||||
#
|
||||
|
||||
LIB_DIR = ../../build/lib
|
||||
|
||||
STATIC_LIB = $(LIB_DIR)/libfloatimg.a
|
||||
|
||||
OBJ_DIR = ../../build/obj
|
||||
|
||||
DYN_OBJ = $(OBJ_DIR)/libfloatimg-lib.o
|
||||
|
||||
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
|
||||
|
||||
OBJS = fimg-core.o fimg-pnm.o fimg-file.o fimg-math.o \
|
||||
@ -13,16 +21,24 @@ DEPS = Makefile ../floatimg.h
|
||||
# modify it 'as you like'
|
||||
AR=ar
|
||||
|
||||
all: $(OBJS) ../libfloatimg.a
|
||||
all: $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
|
||||
|
||||
t: t.c ../libfloatimg.a $(DEPS)
|
||||
gcc $(COPT) $< ../libfloatimg.a -lpnglite -lz -lm -o $@
|
||||
# t: t.c ../libfloatimg.a $(DEPS)
|
||||
# gcc $(COPT) $< ../libfloatimg.a -lpnglite -lz -lm -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJS) $(STATIC_LIB) $(DYN_OBJ)
|
||||
|
||||
# --------------------------------------------
|
||||
|
||||
../libfloatimg.a: $(OBJS)
|
||||
$(STATIC_LIB): $(OBJS)
|
||||
mkdir -p $(LIB_DIR)
|
||||
$(AR) r $@ $?
|
||||
|
||||
$(DYN_OBJ): $(OBJS) # verbosity.o
|
||||
mkdir -p $(OBJ_DIR)
|
||||
ld -Ur -o $@ $?
|
||||
|
||||
fimg-core.o: fimg-core.c $(DEPS)
|
||||
gcc $(COPT) -c $<
|
||||
|
@ -1,5 +1,9 @@
|
||||
/*
|
||||
* contrast.c - part of libfloatimg
|
||||
* --------------------------------
|
||||
*
|
||||
* you can see some use in 'tools/fimgfx.c', so you can thing
|
||||
* about the 'maxval' parameter. C'est touchy :)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -48,7 +52,6 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nbre = s->width * s->height;
|
||||
|
||||
for (idx=0; idx<nbre; idx++) {
|
||||
@ -83,7 +86,6 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nbre = s->width * s->height;
|
||||
|
||||
for (idx=0; idx<nbre; idx++) {
|
||||
@ -97,7 +99,6 @@ for (idx=0; idx<nbre; idx++) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
#macro Cos_01( X )
|
@ -175,11 +175,11 @@ if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type ||
|
||||
nbiter = a->width * a->height;
|
||||
|
||||
for (idx=0; idx<nbiter; idx++) {
|
||||
if (a->R[idx] > b->R[idx]) d->R[idx] = a->R[idx];
|
||||
if (a->R[idx] < b->R[idx]) d->R[idx] = a->R[idx];
|
||||
else d->R[idx] = b->R[idx];
|
||||
if (a->G[idx] > b->G[idx]) d->G[idx] = a->G[idx];
|
||||
if (a->G[idx] < b->G[idx]) d->G[idx] = a->G[idx];
|
||||
else d->G[idx] = b->G[idx];
|
||||
if (a->B[idx] > b->B[idx]) d->B[idx] = a->B[idx];
|
||||
if (a->B[idx] < b->B[idx]) d->B[idx] = a->B[idx];
|
||||
else d->B[idx] = b->B[idx];
|
||||
}
|
||||
|
||||
@ -203,11 +203,11 @@ if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type ||
|
||||
nbiter = a->width * a->height ;
|
||||
|
||||
for (idx=0; idx<nbiter; idx++) {
|
||||
if (a->R[idx] < b->R[idx]) d->R[idx] = a->R[idx];
|
||||
if (a->R[idx] > b->R[idx]) d->R[idx] = a->R[idx];
|
||||
else d->R[idx] = b->R[idx];
|
||||
if (a->G[idx] < b->G[idx]) d->G[idx] = a->G[idx];
|
||||
if (a->G[idx] > b->G[idx]) d->G[idx] = a->G[idx];
|
||||
else d->G[idx] = b->G[idx];
|
||||
if (a->B[idx] < b->B[idx]) d->B[idx] = a->B[idx];
|
||||
if (a->B[idx] > b->B[idx]) d->B[idx] = a->B[idx];
|
||||
else d->B[idx] = b->B[idx];
|
||||
}
|
||||
|
81
src/tools/Makefile
Normal file
81
src/tools/Makefile
Normal file
@ -0,0 +1,81 @@
|
||||
#
|
||||
# makefile for floatimg tools
|
||||
# use with caution
|
||||
#
|
||||
# PLEASE ! update to the 'Global.makefile' concept !
|
||||
#
|
||||
|
||||
COPT = -Wall -fpic -g -DDEBUG_LEVEL=0
|
||||
|
||||
LD_OPTS = -lm
|
||||
|
||||
STATIC_LIB = ../../build/lib/libfloatimg.a
|
||||
|
||||
DEPS = ../floatimg.h $(STATIC_LIB) Makefile
|
||||
|
||||
BIN_DIR = ../../build/bin
|
||||
|
||||
EXECUTABLES = $(BIN_DIR)/fimg2pnm $(BIN_DIR)/mkfimg $(BIN_DIR)/png2fimg \
|
||||
$(BIN_DIR)/fimgstats $(BIN_DIR)/fimg2png $(BIN_DIR)/fimg2tiff \
|
||||
$(BIN_DIR)/fimg2text $(BIN_DIR)/fimg2fits $(BIN_DIR)/addpnm2fimg \
|
||||
$(BIN_DIR)/cumulfimgs $(BIN_DIR)/fimgops $(BIN_DIR)/fimgfx \
|
||||
$(BIN_DIR)/fimghalfsize
|
||||
|
||||
# ----------
|
||||
|
||||
all: fimg2pnm mkfimg png2fimg fimgstats fimg2png \
|
||||
fimg2tiff fimg2text fimg2fits \
|
||||
addpnm2fimg cumulfimgs fimgops fimgfx \
|
||||
fimghalfsize
|
||||
|
||||
clean:
|
||||
rm -rf $(EXECUTABLES)
|
||||
|
||||
fimgstats: fimgstats.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
cumulfimgs: cumulfimgs.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
mkfimg: mkfimg.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimgops: fimgops.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimgfx: fimgfx.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimghalfsize: fimghalfsize.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimg2pnm: fimg2pnm.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimg2fits: fimg2fits.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -lcfitsio -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimg2png: fimg2png.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -lpnglite -lz -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimg2text: fimg2text.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
fimg2tiff: fimg2tiff.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -ltiff -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
#
|
||||
# this tool require an external library
|
||||
# http://la.buvette.org/devel/libimage/libimage.html
|
||||
#
|
||||
addtga2fimg: addtga2fimg.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -limageSO -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
addpnm2fimg: addpnm2fimg.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
||||
|
||||
# if "undefined reference to crc32" then "use -lz"
|
||||
png2fimg: png2fimg.c $(DEPS)
|
||||
gcc $(COPT) $< $(STATIC_LIB) -lpnglite -lz -o $(BIN_DIR)/$@ $(LD_OPTS)
|
||||
|
@ -1,5 +1,8 @@
|
||||
/*
|
||||
FIMGFX
|
||||
|
||||
* some functions here come from 'funcs/contrast.c'
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -22,7 +25,7 @@ typedef struct {
|
||||
|
||||
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_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
|
||||
Fx_xper, Fx_binarize, Fx_trinarize,Fx_hilight_R };
|
||||
|
||||
Fx fx_list[] = {
|
||||
@ -39,6 +42,7 @@ Fx fx_list[] = {
|
||||
{ "ctr2x2", Fx_ctr2x2, 0, 1 },
|
||||
{ "mirror", Fx_mirror, 0, 1 },
|
||||
{ "shift0", Fx_shift0, 0, 1 },
|
||||
{ "trimul", Fx_trimul, 0, 1 },
|
||||
// { "norm", Fx_norm, 0, 1 },
|
||||
{ "classtrial", Fx_classtrial, 0, 1 },
|
||||
{ "binarize", Fx_binarize, 0, 1 },
|
||||
@ -51,6 +55,7 @@ Fx fx_list[] = {
|
||||
static void list_of_effects(void)
|
||||
{
|
||||
Fx *fx;
|
||||
/* this list must be on just ONE columns */
|
||||
for (fx=fx_list; fx->name; fx++) {
|
||||
printf("%s\n", fx->name);
|
||||
}
|
||||
@ -89,7 +94,7 @@ fprintf(stderr, ">>> %s ( %p %p %f )\n", __func__, S, D, kf);
|
||||
|
||||
foo = fimg_classif_trial(S, D, kf, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s err %d classif_trial %p\n", __func__,
|
||||
fprintf(stderr, "%s error %d classif_trial %p\n", __func__,
|
||||
foo, S);
|
||||
return -98;
|
||||
}
|
||||
@ -102,7 +107,7 @@ static void help(int lvl)
|
||||
Fx *fx;
|
||||
int foo;
|
||||
|
||||
printf("-- fimg special effects -- %s %s --\n", __DATE__, __TIME__);
|
||||
printf("-*- fimg special effects -*- %s %s -*-\n", __DATE__, __TIME__);
|
||||
puts("usage:");
|
||||
puts("\tfimgfx [options] <effect> source.fimg resultat.fimg");
|
||||
|
||||
@ -121,7 +126,7 @@ for (fx=fx_list; fx->name; fx++) {
|
||||
foo = 0;
|
||||
}
|
||||
}
|
||||
puts("");
|
||||
puts("\n");
|
||||
fimg_print_version(1);
|
||||
exit(0);
|
||||
}
|
||||
@ -203,9 +208,13 @@ switch (action) {
|
||||
foo = fimg_mirror(&src, &dest, 0);
|
||||
break;
|
||||
case Fx_shift0:
|
||||
fprintf(stderr, "Krkrk %d\n", action);
|
||||
// fprintf(stderr, "Krkrk %d\n", action);
|
||||
foo = fimg_auto_shift_to_zero(&src, &dest);
|
||||
break;
|
||||
case Fx_trimul:
|
||||
fprintf(stderr, "trimul %d\n", action);
|
||||
foo = fimg_sfx_triplemul(&src, &dest, 0);
|
||||
break;
|
||||
case Fx_ctr2x2:
|
||||
foo = fimg_contour_2x2(&src, &dest, 0);
|
||||
break;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user