Compare commits

..

No commits in common. "6e896ee4631168d291d86c8982c3e96b90843c2a" and "8dbe6dd5c15eae77fcc447ec8a617e6af660e79c" have entirely different histories.

18 changed files with 29 additions and 259 deletions

View File

@ -356,7 +356,7 @@ switch (idFx) {
retval = des_bords_sombres_a(image, 160);
break;
case CR_bsombrb: /* experiment ! */
retval = des_bords_sombres_b(image, 120);
retval = des_bords_sombres_b(image, 100);
break;
case CR_vsglitch:

View File

@ -53,29 +53,17 @@ return -1;
static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
{
int x, y, pline, off;
int ym;
fimg_clear_rectangle(pimg, pos);
ym = pos[1]+pos[3]-1;
#define FDIM 0.60
for (y=pos[1]; y<ym; y++) {
for (y=pos[1]; y<pos[1]+pos[3]; y++) {
pline = y*pimg->width;
for (x=0; x<5; x++) {
off = pline + (x+pos[0]);
for (x=pos[0]+2; x<(pos[0]+pos[2]-2); x++) {
off = pline + x;
/* wtf i'm doing here ? */
if ( (pos[1]==y) || (ym-1==y) ) {
pimg->R[off] = fvals[0] * FDIM;
pimg->G[off+5] = fvals[1] * FDIM;
pimg->B[off+10] = fvals[2] * FDIM;
}
else {
pimg->R[off] = fvals[0];
pimg->G[off+5] = fvals[1];
pimg->B[off+10] = fvals[2];
}
pimg->R[off] = fvals[0];
pimg->G[off] = fvals[1];
pimg->B[off] = fvals[2];
}
}
return 0;

View File

@ -16,10 +16,3 @@ printf("this is the version ZERO !!!\n");
}
/* ------------------------------------------------------------ */
int init_empty_cache(int iw, int ih, int szc, int nbre)
{
return -1;
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */

View File

@ -3,5 +3,3 @@
*/
void cachengn_print_version(int k);
int init_empty_cache(int iw, int ih, int szc, int nbre);

View File

@ -6,21 +6,11 @@
#include "cachengn.h"
#define IMGW 320
#define IMGH 240
#define SIZE 20
#define NBRI 1000
/* ------------------------------------------------------------ */
int main(int argc, char *argv[])
{
int foo;
fprintf(stderr, "Test of the cache engin - %s %s\n", __DATE__, __TIME__);
cachengn_print_version(1);
foo = init_empty_cache(IMGW, IMGH, SIZE, NBRI);
fprintf(stderr, "init_empty_cache --> %d\n", foo);
return 0;
}

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul
*/
#define FIMG_VERSION 163
#define FIMG_VERSION 160
/*
* in memory descriptor
@ -53,7 +53,6 @@ typedef struct {
#define FILE_TYPE_FITS 6
#define FILE_TYPE_BMP 7
#define FILE_TYPE_EXR 8
#define FILE_TYPE_DICOM 9
/* lib/contrast.c */
#define CONTRAST_NONE 0
@ -143,9 +142,6 @@ int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k);
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k);
int fimg_decomp_rgbz_gray(FloatImg *psrc, FloatImg *pdst, int k);
int fimg_save_plane_as_dicom(FloatImg *src, char *outname,
char plane, int flags);
/* universal exporter XXX */
int fimg_export_picture(FloatImg *pic, char *fname, int flags);
@ -227,7 +223,6 @@ int fimg_to_gray(FloatImg *head);
int fimg_add_cste(FloatImg *fi, float value);
int fimg_mul_cste(FloatImg *fi, float value);
int fimg_ajust_from_grab(FloatImg *fi, double maxima, int notused);
int fimg_absolute(FloatImg *fimg);
void fimg_drand48(FloatImg *fi, float kmul);
long fimg_count_negativ(FloatImg *fi);
long fimg_clamp_negativ(FloatImg *fi);
@ -246,8 +241,6 @@ int fimg_multirandom(FloatImg *fimg, long nbpass);
/* file is 'funcs/utils.c' */
void fimg_print_minmax(float minmax[6], char *titre);
float *charplane2int(char plane, FloatImg *img);
int parse_WxH(char *str, int *pw, int *ph);
int parse_double(char *str, double *dptr);
int irand2(int offset, int modulo);

View File

@ -11,7 +11,6 @@ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o \
geometry.o rotate.o fimg-openexr.o \
equalize.o fimg-fits.o saturation.o histogram.o \
fimg-dicom.o \
hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \
displacement.o dithering.o plasmas.o incrustator.o \
killrgb.o recurse.o pixelize.o decomprgb.o
@ -71,9 +70,6 @@ fimg-tiff.o: fimg-tiff.c $(DEPS)
fimg-openexr.o: fimg-openexr.c $(DEPS)
gcc $(COPT) -c $<
fimg-dicom.o: fimg-dicom.c $(DEPS)
gcc $(COPT) -c $<
fimg-fits.o: fimg-fits.c $(DEPS)
gcc $(COPT) -I/usr/include/cfitsio/ -c $<

View File

@ -60,7 +60,6 @@ for (y=0; y<h2; y++)
getRpix(psrc, x2+1, y2+1);
cumul /= 4, vgray = cumul;
pdst->R[pixidx(pdst,x,y)] = cumul;
pdst->R[pixidx(pdst,x+w2,y+h2)] = cumul;
cumul = getGpix(psrc, x2, y2) +
getGpix(psrc, x2, y2+1) +
@ -68,7 +67,6 @@ for (y=0; y<h2; y++)
getGpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
pdst->G[pixidx(pdst,x+w2,y)] = cumul;
pdst->G[pixidx(pdst,x+w2,y+h2)] = cumul;
cumul = getBpix(psrc, x2, y2) +
getBpix(psrc, x2, y2+1) +
@ -76,8 +74,10 @@ for (y=0; y<h2; y++)
getBpix(psrc, x2+1, y2+1);
cumul /= 4, vgray += cumul;
pdst->B[pixidx(pdst,x,y+h2)] = cumul;
pdst->B[pixidx(pdst,x+w2,y+h2)] = cumul;
idx = pixidx(pdst,x+w2,y+h2);
pdst->R[idx] = pdst->G[idx] = \
pdst->B[idx] = vgray / 3.0;
}
}

View File

@ -10,34 +10,6 @@
#include "../floatimg.h"
extern int verbosity;
/* -------------------------------------------------------------------- */
int fimg_show_filter(char *title, FimgFilter3x3 *filtr)
{
float *M; /* alias of filter matrix */
int foo, idx;
float sum, value;
if (title) fprintf(stderr, "--------- %s ---------\n", title);
M = filtr->matrix; /* aliasing here */
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[0], M[1], M[2]);
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[3], M[4], M[5]);
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[6], M[7], M[8]);
sum = 0.0;
for (idx=0; idx<9; idx++) sum += M[idx];
fprintf(stderr, " sum %8.3f\n", sum);
fprintf(stderr, " mult %8.3f\n", filtr->mult);
fprintf(stderr, " offset %8.3f\n", filtr->offset);
value = (sum * filtr->mult) + filtr->offset;
fprintf(stderr, " value %8.3f ???\n", sum);
return 0;
}
/* -------------------------------------------------------------------- */
int fimg_filter_3x3(FloatImg *src, FloatImg *dst, FimgFilter3x3 *filtr)
{
@ -63,10 +35,6 @@ if (fimg_images_not_compatible(src, dst)) {
return -98;
}
if (verbosity) {
fimg_show_filter("essai", filtr);
}
/* aliasing some vars for cleaner code */
pr = src->R; pg = src->G; pb = src->B;
w = src->width; h = src->height;

View File

@ -1,32 +0,0 @@
/*
Digital Imaging and Communications in Medicine
nouveau Fri 26 Nov 2021 11:12:44 PM CET - allée de Dinan
*/
#include <stdio.h>
#include <stdint.h>
#include "../floatimg.h"
extern int verbosity; /* must be declared around main() */
/* --------------------------------------------------------------------- */
int fimg_save_plane_as_dicom(FloatImg *src, char *outname,
char plane, int flags)
{
int foo;
float *planeptr;
fprintf(stderr, ">>> %s ( %p %s %c %d )\n", __func__, src, outname, plane, flags);
planeptr = charplane2int(plane, src);
if (verbosity) {
fimg_describe(src, outname);
}
return -1;
}
/* --------------------------------------------------------------------- */

View File

@ -17,12 +17,6 @@
extern int verbosity;
/*
https://baillehachepascal.dev/2021/rgb_hsv.php
*/
/* --------------------------------------------------------------------- */
/* helper functions */
static float maxi3f(float a, float b, float c)
@ -35,7 +29,7 @@ return ((a < b)? (a < c ? a : c) : (b < c ? b : c));
}
static int pseudoeq(float a, float b)
{
return (fabsf(a-b)<0.00000001); // UGLY HACK ???
return (fabsf(a-b)<0.00000000000001); // UGLY HACK ???
}
/* --------------------------------------------------------------------- */
/*

View File

@ -24,8 +24,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
Geometrie, FileType, Mirror, KillRGB,
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
Rectangle, Dicom };
Pixelize,SplitLevel,DecompRgbz, Rectangle };
typedef struct {
char *name;
int Cmd;
@ -57,9 +56,7 @@ Command commands[] = {
{ "pixelize", Pixelize },
{ "spltlvl", SplitLevel },
{ "decomprgbz", DecompRgbz },
{ "decomprgbg", DecompRgbg },
{ "rectangle", Rectangle },
{ "dicom", Dicom },
{ NULL, 0 }
} ;
@ -235,17 +232,11 @@ switch(opt) {
foo = essai_split_level(filename, outfile, 0);
break;
case DecompRgbz:
foo = essai_decomprgb_color(filename, outfile);
break;
case DecompRgbg:
foo = essai_decomprgb_gray(filename, outfile);
foo = essai_decomprgb(filename, outfile);
break;
case Rectangle:
essai_rectangle(outfile, 0);
break;
case Dicom:
foo = essai_dicom(filename, outfile, 0);
break;
default:
fprintf(stderr, "'%s' is a bad command\n", command);

View File

@ -17,23 +17,6 @@
extern int verbosity;
/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
int essai_dicom(char *inf, char *outf, int k)
{
int foo;
FloatImg img;
fprintf(stderr, ">>> %s ( %s %s %d )\n", __func__, inf, outf, k);
foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB);
fimg_drand48(&img, 1.0);
foo = fimg_save_plane_as_dicom(&img, outf, 'R', 0);
fprintf(stderr, "dicom: save a plane --> %d\n", foo);
return -1;
}
/* --------------------------------------------------------------------- */
int essai_rectangle(char *outf, int k)
{
@ -91,7 +74,8 @@ if (foo) {
return 0;
}
/* --------------------------------------------------------------------- */
int essai_decomprgb_gray(char *inf, char *outf)
/* --------------------------------------------------------------------- */
int essai_decomprgb(char *inf, char *outf)
{
int foo;
FloatImg src, dst;
@ -121,39 +105,6 @@ if (foo) {
fimg_destroy(&src); fimg_destroy(&dst);
return 0;
}
/* --------------------------------------------------------------------- */
int essai_decomprgb_color(char *inf, char *outf)
{
int foo;
FloatImg src, dst;
fprintf(stderr, ">>> %s ( %s %s )\n", __func__, inf, outf);
foo = fimg_create_from_dump(inf, &src);
if (0 != foo) {
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
foo, inf);
return foo;
}
fimg_clone(&src, &dst, 1);
foo = fimg_decomp_rgbz_color(&src, &dst, 0);
if (foo) {
fprintf(stderr, "%s:%s(): fail %d line %d\n",
__FILE__, __func__, foo, __LINE__);
return foo;
}
foo = fimg_export_picture(&dst, outf, 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
fimg_destroy(&src); fimg_destroy(&dst);
return 0;
}
/* --------------------------------------------------------------------- */

View File

@ -6,8 +6,7 @@
int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef);
int essai_miroir(char *inf, char *outf, int flags);
int essai_killrgb(char *inf, char *outf);
int essai_decomprgb_color(char *inf, char *outf);
int essai_decomprgb_gray(char *inf, char *outf);
int essai_decomprgb(char *inf, char *outf);
int essai_split_level(char *inf, char *outf, int flags);
int essai_displacement(char *infile, char *outfile);
@ -36,6 +35,3 @@ int essai_openexr(char *inf, char *outf, int flags);
int essai_pixelize(char *infile, char *outfile);
int essai_rectangle(char *outf, int k);
int essai_dicom(char *inf, char *outf, int k);

View File

@ -21,30 +21,6 @@ fprintf(stderr, "green\t\t%10f %10f\n", minmax[2], minmax[3]);
fprintf(stderr, "blue\t\t%10f %10f\n", minmax[4], minmax[5]);
}
/* --------------------------------------------------------------------- */
/* used in fimg-fits & fimg-dicom */
float *charplane2int(char plane, FloatImg *img)
{
float *pplane = NULL;
fprintf(stderr, "get plane for '%c' in %p ", plane, img);
switch (plane) {
case 'r': case 'R':
pplane = img->R; break;
case 'g': case 'G':
pplane = img->G; break;
case 'b': case 'B':
pplane = img->B; break;
default:
pplane = NULL;
}
fprintf(stderr, "give me %p\n", pplane);
return pplane;
}
/* --------------------------------------------------------------------- */
int parse_WxH(char *str, int *pw, int *ph)
{
// char *ptr;
@ -91,15 +67,14 @@ int file_type_from_name(char *name)
fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name);
#endif
if (!strcasecmp(name, "pnm" )) return FILE_TYPE_PNM;
if (!strcasecmp(name, "fimg")) return FILE_TYPE_FIMG;
if (!strcasecmp(name, "tga" )) return FILE_TYPE_TGA;
if (!strcasecmp(name, "png" )) return FILE_TYPE_PNG;
if (!strcasecmp(name, "tiff")) return FILE_TYPE_TIFF;
if (!strcasecmp(name, "tif" )) return FILE_TYPE_TIFF;
if (!strcasecmp(name, "fits")) return FILE_TYPE_FITS;
if (!strcasecmp(name, "exr")) return FILE_TYPE_EXR;
if (!strcasecmp(name, "dicom")) return FILE_TYPE_EXR;
if (!strcasecmp(name, "pnm" )) return FILE_TYPE_PNM;
if (!strcasecmp(name, "fimg")) return FILE_TYPE_FIMG;
if (!strcasecmp(name, "tga" )) return FILE_TYPE_TGA;
if (!strcasecmp(name, "png" )) return FILE_TYPE_PNG;
if (!strcasecmp(name, "tiff")) return FILE_TYPE_TIFF;
if (!strcasecmp(name, "tif" )) return FILE_TYPE_TIFF;
if (!strcasecmp(name, "fits")) return FILE_TYPE_FITS;
if (!strcasecmp(name, "exr")) return FILE_TYPE_EXR;
return -1;
}

View File

@ -1,5 +1,5 @@
/*
* fimg-math.c
* fimg-core.c
*
*
*/
@ -295,22 +295,6 @@ fimg_mul_cste(fi, coef);
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_absolute(FloatImg *fi)
{
int surface, idx;
surface = fi->width * fi->height;
for (idx=0; idx<surface; idx++) {
fi->R[idx] = fabsf(fi->R[idx]);
fi->G[idx] = fabsf(fi->G[idx]);
fi->B[idx] = fabsf(fi->B[idx]);
}
return 0;
}
/* ---------------------------------------------------------------- */
/* Warning: this function is _very_ slow */
void fimg_drand48(FloatImg *fi, float kmul)
{

View File

@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <math.h>

View File

@ -27,8 +27,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_trimul,
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
Fx_absolute, Fx_clamp };
Fx_xper, Fx_binarize, Fx_trinarize,Fx_hilight_R };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 },
@ -50,8 +49,6 @@ Fx fx_list[] = {
{ "binarize", Fx_binarize, 0, 1 },
{ "trinarize", Fx_trinarize, 0, 1 },
{ "hilightr", Fx_hilight_R, 0, 1 },
{ "abs", Fx_absolute, 0, 1 },
{ "clamp", Fx_clamp, 0, 1 },
{ NULL, 0, 0, 0 }
};
@ -234,17 +231,6 @@ switch (action) {
foo = fimg_highlight_color(&src, &dest, 'R', 1.333);
break;
case Fx_absolute:
fimg_copy_data(&src, &dest);
foo = fimg_absolute(&dest);
break;
case Fx_clamp:
fimg_copy_data(&src, &dest);
foo = fimg_clamp_negativ(&dest);
/* this func return the count of
negative pixels killed */
if (foo > 0) foo = 0;
break;
default:
fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action);
@ -306,7 +292,7 @@ if (action < 0) {
exit(1);
}
if (verbosity > 1) {
if (verbosity) {
fprintf(stderr, " global fvalue %f\n", global_fvalue);
fprintf(stderr, " action %d\n", action);
fprintf(stderr, " verbosity %d\n", verbosity);
@ -318,7 +304,7 @@ if ((nba=fx_list[action].nbarg)) {
srcname = argv[optind+1];
dstname = argv[optind+2];
if (verbosity > 1) fprintf(stderr, "Fx %s ==> %s\n", srcname, dstname);
if (verbosity) fprintf(stderr, "%s ==> %s\n", srcname, dstname);
foo = do_an_effect(srcname, action, dstname);
if (foo) {