Compare commits

..

No commits in common. "5a90dce59d1bc80928de9765ffa37f531eabdce6" and "fed3076b925cd853010ffa3f2fa3c2c7fb9c3ed5" have entirely different histories.

11 changed files with 12 additions and 184 deletions

1
.gitignore vendored
View File

@ -84,5 +84,4 @@ experiment/extracteur
experiment/*.fimg
experiment/*.pnm
experiment/*.o
experiment/muxplanes

View File

@ -4,8 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../floatimg.h"
#include "metriques.h"

View File

@ -6,13 +6,10 @@ COPT = -Wall -fpic -g -DDEBUG_LEVEL=1 -lm
DEPS = ../floatimg.h ../libfloatimg.a Makefile
LIBS = -ltiff -lpnglite -lcfitsio
all: assemblage extracteur muxplanes
all: assemblage extracteur
assemblage: assemblage.c ${DEPS}
gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
gcc $(COPT) $< ../libfloatimg.a $(LIBS) -o $@
extracteur: extracteur.c ${DEPS}
gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
muxplanes: muxplanes.c ${DEPS}
gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
gcc $(COPT) $< ../libfloatimg.a $(LIBS) -o $@

View File

@ -4,7 +4,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../floatimg.h"

View File

@ -4,10 +4,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include "../floatimg.h"
// #include "incrustator.h"
int verbosity;
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
@ -23,7 +24,7 @@ float rgb[3];
if (verbosity) {
fimg_describe(in, "source");
fimg_describe(out, "destination");
print_rectangle((char *)__func__, rect);
print_rectangle(__func__, rect);
}
count = 0;

View File

@ -1,97 +0,0 @@
/*
* another ugly experiment
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <strings.h>
#include "../floatimg.h"
int verbosity;
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int triplane_muxer(FloatImg *sr, FloatImg *sg, FloatImg *sb,
FloatImg *dst, int flages)
{
int foo;
int sz;
if (FIMG_TYPE_RGB != dst->type) {
fprintf(stderr, "%s: dst picz must be RGB, was %d\n",
__func__, dst->type);
return -99;
}
if ( fimg_images_not_compatible(sr, sg) ||
fimg_images_not_compatible(sr, sb) ||
fimg_images_not_compatible(sr, dst) ) {
fprintf(stderr, "%s: compatibility error\n", __func__);
return -2;
}
sz = sr->width * sr->height * sizeof(float);
memcpy(dst->R, sr->R, sz);
memcpy(dst->G, sg->G, sz);
memcpy(dst->B, sb->B, sz);
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int try_this_muxplane(char *fr, char *fg, char *fb, char *dst, int flags)
{
int foo;
FloatImg imr, img, imb, dest;
fprintf(stderr, "muxing: %s %s %s --> %s\n", fr, fg, fb, dst);
foo = fimg_create_from_dump(fr, &imr);
if (foo) {
fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fr);
return -1;
}
foo = fimg_create_from_dump(fg, &img);
if (foo) {
fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fr);
return -1;
}
foo = fimg_create_from_dump(fb, &imb);
if (foo) {
fprintf(stderr, "%s: err %d loading %s\n", __func__, foo, fr);
return -1;
}
fimg_clone(&imr, &dest, 0);
foo = triplane_muxer(&imr, &img, &imb, &dest, 0);
if (foo) {
fprintf(stderr, "%s: err %d\n", __func__, foo);
return foo;
}
fimg_export_picture(&dest, dst, 0);
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int main(int argc, char *argv[])
{
int foo;
if (5 != argc) {
fprintf(stderr, "ERROR: %s need four fimg files arguments\n", argv[0]);
return 1;
}
foo = try_this_muxplane(argv[1], argv[2], argv[3], argv[4], 0);
if (foo) {
fprintf(stderr, "oups %d\n", foo);
exit(1);
}
return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */

View File

@ -1,24 +0,0 @@
#!/bin/bash
GRABOPT=" -vv -d /dev/video0 -n 400 -p 0.5 -u "
SPOOL=${HOME}/TMP
echo ; echo ; echo
for capture in red green blue
do
image=${SPOOL}/${capture}.fimg
echo grabbing $image
grabvidseq ${GRABOPT} -o $image
echo
done
./muxplanes "${SPOOL}/red.fimg" \
"${SPOOL}/green.fimg" \
"${SPOOL}/blue.fimg" \
yo.fimg
echo $0 "got a" $?
fimgstats -v yo.fimg

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
echo "=== make a lot of float img ==="
MKFIMG="../tools/mkfimg"
SIZE=" 640x480 "
for type in $(${MKFIMG} -L)
do
picname="/tmp/${type}.fimg"
echo $picname
${MKFIMG} -v -t $type $picname $SIZE
done

View File

@ -1,31 +1,17 @@
# Images en virgule flottante, les outils.
Dans tous les cas, vous pouvez utiliser l'option `-h` pour avoir des
explications sur ce que vous pouvez faire, et l'option `-v` pour suivre
l'avancée des travaux.
explications sur ce que vous pouvez faire.
## mkfimg
Génération d'une image flottante avec des choses dedans.
Un [../scripts/demo-mkfimg.sh](script) permet de créer toutes
les images disponibles.
## fimgops
## fimgfx
effects:
cos01 cos010 pow2 sqrt gray0 cmixa xper desat ctr2x2 mirror
shift0 trimul classtrial binarize trinarize hilightr
## fimgstats
Compute some useless numbers...
## fimg2pnm - fimg2png - fimg2tiff
Exportation d'image flottante vers divers formats. Certains d'entre eux
ne sont gérés que de façon très rudimentaire.
## fimg2pnm - fimg2png
## fimg2text

View File

@ -49,6 +49,8 @@ Type *type;
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name);
#endif
// #define TEST(str) ( ! strcmp(name, str) )
for (type = types; type->code; type++) {
if (!strcmp(name, type->name)) {
return type->code;
@ -58,16 +60,6 @@ for (type = types; type->code; type++) {
return -1;
}
/* --------------------------------------------------------------------- */
static void list_types(void)
{
Type *type;
for (type = types; type->code; type++) {
puts(type->name);
}
exit(0);
}
/* --------------------------------------------------------------------- */
static void help(int lj)
{
int foo, cc;
@ -75,7 +67,6 @@ int foo, cc;
puts("Usage:\tmkfimg [options] quux.fimg width height");
puts("\t-k N.N\tgive a float parameter");
puts("\t-L\tlist howto make a pic");
fputs("\t-t bla\thowto make the pic :\n\t\t| ", stdout);
for (foo=cc=0; types[foo].code; foo++) {
@ -104,13 +95,12 @@ char *tname = "wtf?";
FloatImg fimg;
while ((opt = getopt(argc, argv, "hk:Lt:v")) != -1) {
while ((opt = getopt(argc, argv, "hk:t:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'k': fvalue = atof(optarg); break;
case 't': type = get_type_by_name(tname=optarg);
break;
case 'L': list_types(); break;
case 'v': verbosity++; break;
}
}

View File

@ -1,9 +1,6 @@
/*
* UGLY CODE INSIDE
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "../floatimg.h"
#include "funcs.h"
@ -88,11 +85,6 @@ int x_add_rgb2fimg(unsigned char *src, int w, int h, FloatImg *d)
int iter, size;
float *rp, *gp, *bp;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d %d %p )\n", __func__,
src, w, h, d);
#endif
size = w * h;
rp = d->R, gp = d->G, bp = d->B;