Compare commits
7 Commits
fed3076b92
...
5a90dce59d
Author | SHA1 | Date | |
---|---|---|---|
|
5a90dce59d | ||
|
17955bd303 | ||
|
865cc60ccf | ||
|
f77a63b08c | ||
|
389beea6cd | ||
|
b2d2c45be1 | ||
|
468b5feb74 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -84,4 +84,5 @@ experiment/extracteur
|
||||
experiment/*.fimg
|
||||
experiment/*.pnm
|
||||
experiment/*.o
|
||||
experiment/muxplanes
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
#include "metriques.h"
|
||||
|
||||
|
@ -6,10 +6,13 @@ COPT = -Wall -fpic -g -DDEBUG_LEVEL=1 -lm
|
||||
DEPS = ../floatimg.h ../libfloatimg.a Makefile
|
||||
LIBS = -ltiff -lpnglite -lcfitsio
|
||||
|
||||
all: assemblage extracteur
|
||||
all: assemblage extracteur muxplanes
|
||||
|
||||
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 $@
|
||||
gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
|
||||
|
||||
muxplanes: muxplanes.c ${DEPS}
|
||||
gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
|
@ -4,11 +4,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
// #include "incrustator.h"
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
|
||||
@ -24,7 +23,7 @@ float rgb[3];
|
||||
if (verbosity) {
|
||||
fimg_describe(in, "source");
|
||||
fimg_describe(out, "destination");
|
||||
print_rectangle(__func__, rect);
|
||||
print_rectangle((char *)__func__, rect);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
97
experiment/muxplanes.c
Normal file
97
experiment/muxplanes.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
|
24
experiment/tripla.sh
Executable file
24
experiment/tripla.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/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
|
||||
|
13
scripts/demo-mkfimg.sh
Executable file
13
scripts/demo-mkfimg.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/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
|
@ -1,17 +1,31 @@
|
||||
# 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.
|
||||
explications sur ce que vous pouvez faire, et l'option `-v` pour suivre
|
||||
l'avancée des travaux.
|
||||
|
||||
## 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
|
||||
|
||||
## fimg2pnm - fimg2png
|
||||
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.
|
||||
|
||||
## fimg2text
|
||||
|
||||
|
@ -49,8 +49,6 @@ 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;
|
||||
@ -60,6 +58,16 @@ 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;
|
||||
@ -67,6 +75,7 @@ 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++) {
|
||||
@ -95,12 +104,13 @@ char *tname = "wtf?";
|
||||
|
||||
FloatImg fimg;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hk:t:v")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hk:Lt: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;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* UGLY CODE INSIDE
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../floatimg.h"
|
||||
|
||||
#include "funcs.h"
|
||||
@ -85,6 +88,11 @@ 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user