start of the fake colors module

This commit is contained in:
tth 2022-05-18 11:55:01 +02:00
parent 3c551b6c7c
commit e224ab83b6
6 changed files with 88 additions and 5 deletions

View File

@ -5,7 +5,7 @@
* https://git.tetalab.org/tTh/FloatImg
*/
#define FIMG_VERSION (186)
#define FIMG_VERSION (187)
#define RELEASE_NAME ("noname")
/*
* in memory descriptor
@ -189,6 +189,9 @@ int fimg_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
int fimg_auto_shift_to_zero(FloatImg *s, FloatImg *d);
/* funcs/falsecolors.c */
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf);
/* --> funcs/plasmas.c */
int fimg_prototype_plasma(FloatImg *img, double time, int type);

View File

@ -9,6 +9,7 @@ DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o rectangle.o \
sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \
falsecolors.o \
geometry.o rotate.o fimg-openexr.o \
equalize.o fimg-fits.o saturation.o histogram.o \
fimg-dicom.o \
@ -137,6 +138,9 @@ qsortrgb.o: qsortrgb.c $(DEPS)
exporter.o: exporter.c $(DEPS)
gcc $(COPT) -c $<
falsecolors.o: falsecolors.c $(DEPS)
gcc $(COPT) -c $<
hsv.o: hsv.c $(DEPS)
gcc $(COPT) -c $<

39
funcs/falsecolors.c Normal file
View File

@ -0,0 +1,39 @@
/*
* FloatImg library from tTh - really ugly code inside
*/
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#include "../floatimg.h"
/* -------------------------------------------------------------- */
/* this is a global vars exported from main */
extern int verbosity;
/* -------------------------------------------------------------- */
/* -------------------------------------------------------------- */
/* nouveau 18 mai 2022 */
int fimg_falsecolors_0(FloatImg *src, FloatImg *dst, int k, float valf)
{
int x, y;
fprintf(stderr, ">>> %s ( %p %p %d %f )\n", __func__,
src, dst, k, valf);
for (y=0; y<src->height, y++) {
for (x=0; x<src->width, x++) {
/***********************/
/* DO SOMETHING HERE ! */
/***********************/
}
}
return -1;
}
/* -------------------------------------------------------------- */

View File

@ -25,7 +25,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
Geometrie, FileType, Mirror, KillRGB,
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
Rectangle, Dicom };
Rectangle, Dicom, Fakolor0, Fakolor3 };
typedef struct {
char *name;
int Cmd;
@ -60,6 +60,8 @@ Command commands[] = {
{ "decomprgbg", DecompRgbg },
{ "rectangle", Rectangle },
{ "dicom", Dicom },
{ "fakolor0", Fakolor0 },
{ "fakolor3", Fakolor3 },
{ NULL, 0 }
} ;
@ -248,7 +250,9 @@ switch(opt) {
case Dicom:
foo = essai_dicom(filename, outfile, 0);
break;
case Fakolor0:
foo = essai_0_fausses_couleurs(outfile, 0);
break;
default:
fprintf(stderr, "'%s' is a bad command\n", command);
exit(1);
@ -256,7 +260,7 @@ switch(opt) {
}
if (foo) {
fprintf(stderr, "******* Essai --> %d\n", foo);
fprintf(stderr, "******* essai --> %d\n\n", foo);
}
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid());

View File

@ -18,6 +18,26 @@
extern int verbosity;
/* --------------------------------------------------------------------- */
/* nouveau 18 mai 2022 */
int essai_0_fausses_couleurs(char *dstfile, int type)
{
FloatImg src, dst;
int foo;
#define W 1024
#define H 768
fprintf(stderr, "\nEssais fausses couleurs (type %d) -> '%s'\n", type, dstfile);
foo = fimg_create(&src, W, H, FIMG_TYPE_RGB);
foo = fimg_hdeg_a(&src, 12e3);
foo = fimg_clone(&src, &dst, 0);
foo = fimg_clear(&dst);
foo = fimg_falsecolors_0(&src, &dst, type, 3.141592654);
foo= fimg_export_picture(&dst, dstfile, 0);
return -1;
}
/* --------------------------------------------------------------------- */
int essai_dicom(char *inf, char *outf, int k)
{
@ -41,6 +61,10 @@ FloatImg img;
int foo;
int rect[4];
if (0 != k) {
fprintf(stderr, "in %s, k muste be 0, was %d\n", __func__, k);
}
foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB);
fimg_drand48(&img, 1.0);
@ -741,6 +765,10 @@ int essai_geometrie(char *infile, int notused)
FloatImg fimg, result;
int foo;
if (0 != notused) {
fprintf(stderr, "in %s, k must be 0, was %d\n", __func__, notused);
}
if (NULL != infile) {
fprintf(stderr, "loading %s\n", infile);
foo = fimg_create_from_dump(infile, &fimg);
@ -879,13 +907,17 @@ int essai_mire(char *outname, int notused)
FloatImg fimg;
int re, foo;
if (0 != notused) {
fprintf(stderr, "in %s, k must be 0, was %d\n", __func__, notused);
}
fimg_create(&fimg, 1280, 960, FIMG_TYPE_RGB);
re = fimg_test_pattern(&fimg, 9, 1.0);
if (re) {
fprintf(stderr, "fimg_test_pattern -> %d\n", re);
}
foo = fimg_export_picture(&fimg, "mire.pnm", 0);
foo = fimg_export_picture(&fimg, outname, 0);
fprintf(stderr, "in %s, export give a %d value\n", __func__, foo);
return 0;

View File

@ -28,6 +28,7 @@ int essai_geometrie(char *infile, int notused);
int essai_detect_type(void);
int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
int essai_histogramme(char *fname, int k);
int essai_0_fausses_couleurs(char *dstfile, int type);
int essai_lecture_png(char *fname, char *outfile, int notused);