not ready for prime time

This commit is contained in:
tth 2021-04-28 00:21:45 +02:00
parent 821377f666
commit bcc534a54d
12 changed files with 50 additions and 36 deletions

View File

@ -2,8 +2,8 @@
C'est d"abord un ensemble de fonctions pour traiter des images avec une énorme dynamique
sur les niveaux de pixels. C'est aussi quelques outils pour traiter ces images.
Et c'est enfin un embryon de logiciel destiné à faire des photos floues, voire même
des [films flous](Fonderie/).
Et c'est enfin plusieurs embryons de logiciel destiné à faire des photos floues,
voire même des [films flous](Fonderie/).
![horloge floue](http://la.buvette.org/photos/cumul/horloge.png "horloge floue")

View File

@ -8,10 +8,7 @@ LIBS = -ltiff -lpnglite -lcfitsio
all: assemblage extracteur
incrustator.o: incrustator.c incrustator.h Makefile
gcc -c $(COPT) $<
assemblage: assemblage.c Makefile incrustator.o
assemblage: assemblage.c Makefile
gcc $(COPT) $< incrustator.o ../libfloatimg.a $(LIBS) -o $@
extracteur: extracteur.c Makefile

View File

@ -14,7 +14,7 @@ int verbosity;
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int print_rectangle(Rectangle *rect)
int print_rectangle(FimgArea51 *rect)
{
printf("rect @ %p : %dx%d at %d,%d\n", rect, rect->w, rect->h,
@ -24,7 +24,7 @@ return 0;
}
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
/* ---------------------------------------------- ~~~~~~~~~~~~~~~~ */
int essai_extraction(FloatImg *in, FloatImg *out, Rectangle *rect)
int essai_extraction(FloatImg *in, FloatImg *out, FimgArea51 *rect)
{
int foo;
int xs, ys, xd, yd;
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
{
int foo, opt;
FloatImg src, dst;
Rectangle zone;
FimgArea51 zone;
char *infile = "foo.fimg";
char *outfile = "out.fimg";

View File

@ -2,11 +2,8 @@
* incrustator experimental
*/
typedef struct {
unsigned long magic;
int w, h;
int x, y;
} FimgArea51;
/*
* MOVED TO 'funcs/inscrutator.c'
*/
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags);

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul
*/
#define FIMG_VERSION 137
#define FIMG_VERSION 141
/*
* in memory descriptor
@ -33,7 +33,7 @@ typedef struct {
int w, h;
int x, y;
int flags;
} Rectangle;
} FimgArea51;
#define FIMG_TYPE_GRAY 1
#define FIMG_TYPE_RGB 3
@ -164,11 +164,16 @@ int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k);
int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused);
/* module funcs/geometry.c */
/* warning, this module is a mess */
int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused);
int fimg_halfsize_1(FloatImg *src, FloatImg *dst, int notused);
int fimg_extractor(FloatImg *in, FloatImg *out, Rectangle *rect);
int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect);
int fimg_mirror(FloatImg *src, FloatImg *dst, int notused);
int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags);
int fimg_displacement_0(FloatImg *psrc, FloatImg *pdst, int flags);
/* module funcs/rampes.c */
@ -217,7 +222,7 @@ int fimg_multirandom(FloatImg *fimg, long nbpass);
void fimg_print_minmax(float minmax[6], char *titre);
int parse_WxH(char *str, int *pw, int *ph);
int parse_double(char *str, double *dptr);
int parse_rectangle(char *str, Rectangle *r, int notused);
int parse_rectangle(char *str, FimgArea51 *r, int notused);
int format_from_extension(char *fname);
char * extension_from_format(int fmt);

View File

@ -11,7 +11,7 @@ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.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
displacement.o dithering.o plasmas.o incrustator.o
#---------------------------------------------------------------
@ -33,7 +33,12 @@ tests.o: tests.c tests.h $(DEPS)
../libfloatimg.a: $(OBJS)
$(AR) r $@ $?
displacement.o: displacement.c $(DEPS)
# ###
incrustator.o: incrustator.c $(DEPS)
gcc $(COPT) -c $<
displacement.o: displacement.c $(DEPS)
gcc $(COPT) -c $<
fimg-png.o: fimg-png.c $(DEPS)

View File

@ -105,7 +105,7 @@ for (y=0; y<hd; y++) {
return 0;
}
/* --------------------------------------------------------------------- */
int fimg_extractor(FloatImg *in, FloatImg *out, Rectangle *rect)
int fimg_extractor(FloatImg *in, FloatImg *out, FimgArea51 *rect)
{
int foo;
int xs, ys, xd, yd;
@ -136,6 +136,8 @@ for (yd=0; yd<rect->h; yd++) {
return 0;
}
/* --------------------------------------------------------------------- */
/* ho, btw, you can have a locck at 'incrustator.c' :) */
/* --------------------------------------------------------------------- */
int fimg_mirror(FloatImg *src, FloatImg *dst, int notused)
{
float *fptr;

View File

@ -1,5 +1,6 @@
/*
* incrustator experimental
* KRKRK
*/
#include <stdio.h>
@ -8,7 +9,7 @@
#include "../floatimg.h"
#include "incrustator.h"
// XXX #include "incrustator.h"
extern int verbosity;
@ -43,7 +44,7 @@ fprintf(stderr, ">>> %s ( %p %p %p 0x%04x )\n", __func__,
return -1;
}
/* ---------------------------------------------------------------- */
int incrustator_0(FloatImg *psrc, FloatImg *pdst,
int fimg_incrustator_0(FloatImg *psrc, FloatImg *pdst,
int xpos, int ypos, int flags)
{
int y, srcpos, dstpos, szl;

View File

@ -1,5 +1,5 @@
/*
* FloatImg library from tTh - ugly code inside
* FloatImg library from tTh - really ugly code inside
*/
#include <stdio.h>
@ -7,7 +7,7 @@
#include "../floatimg.h"
/* -------------------------------------------------------------- */
/* global vars from main
/* global vars exported from main
*/
extern int verbosity;
@ -28,7 +28,6 @@ if (FIMG_TYPE_RGB != img->type) {
for (y=0; y<img->height; y++) {
p = y * img->width; /* first pixel of the row */
for (x=0; x<img->width; x++) {
gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0;
@ -36,15 +35,12 @@ for (y=0; y<img->height; y++) {
img->R[p] = ((gr * mix) + (img->R[p] * (1.0-mix))) / 2.0;
img->G[p] = ((gr * mix) + (img->G[p] * (1.0-mix))) / 2.0;
img->B[p] = ((gr * mix) + (img->B[p] * (1.0-mix))) / 2.0;
p++; /* next pixel in the row */
}
}
return 0;
}
/* -------------------------------------------------------------- */
/*
* The third parameter was a six value array with min and max
@ -60,7 +56,6 @@ if (FIMG_TYPE_RGB != s->type) {
}
sz = s->width * s->height;
for (idx=0; idx<sz; idx++) {
d->R[idx] = s->R[idx] - coefs[0];
d->G[idx] = s->G[idx] - coefs[2];
@ -69,10 +64,10 @@ for (idx=0; idx<sz; idx++) {
return 0;
}
/* -------------------------------------------------------------- */
/*
* I think that this function is fully buggy
* I think that this function is fully buggy, and need
* more explanations.
*/
int fimg_auto_shift_to_zero(FloatImg *src, FloatImg *dst)
{
@ -80,6 +75,10 @@ float coefs[6];
int foo;
float minima = 1e7; /* magic value ? */
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
#endif
if (FIMG_TYPE_RGB != src->type) {
fprintf(stderr, "%s: bad image type %d\n", __func__, src->type);
return -6;

View File

@ -75,7 +75,7 @@ return -1;
/*
* /!\ return 4 on success
*/
int parse_rectangle(char *str, Rectangle *r, int notused)
int parse_rectangle(char *str, FimgArea51 *r, int notused)
{
int x, y, w, h, foo;

View File

@ -22,7 +22,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_classtrial, Fx_mirror, Fx_shift0,
Fx_xper, Fx_binarize, Fx_trinarize,Fx_hilight_R };
Fx fx_list[] = {
@ -38,6 +38,7 @@ Fx fx_list[] = {
{ "desat", Fx_desat, 0, 1 },
{ "ctr2x2", Fx_ctr2x2, 0, 1 },
{ "mirror", Fx_mirror, 0, 1 },
{ "shift0", Fx_shift0, 0, 1 },
// { "norm", Fx_norm, 0, 1 },
{ "classtrial", Fx_classtrial, 0, 1 },
{ "binarize", Fx_binarize, 0, 1 },
@ -208,6 +209,10 @@ switch (action) {
case Fx_mirror:
foo = fimg_mirror(&src, &dest, 0);
break;
case Fx_shift0:
fprintf(stderr, "Krkrk %d\n", action);
foo = fimg_auto_shift_to_zero(&src, &dest);
break;
case Fx_ctr2x2:
foo = fimg_contour_2x2(&src, &dest, 0);
break;

View File

@ -84,7 +84,10 @@ if (verbosity) {
}
foo = faire_un_halfsize(srcname, dstname, grayed);
if (foo) {
fprintf(stderr, "in %s: make halfsize give a %d\n", argv[0], foo);
exit(1);
}
return 0;
}