Compare commits
3 Commits
70694cf592
...
154844c94d
Author | SHA1 | Date | |
---|---|---|---|
|
154844c94d | ||
|
bf239a9004 | ||
|
7d66b09635 |
@ -226,6 +226,20 @@ ret = graylevel2popcolors(img, &tmp, k);
|
|||||||
fimg_copy_data(&tmp, img);
|
fimg_copy_data(&tmp, img);
|
||||||
fimg_destroy(&tmp);
|
fimg_destroy(&tmp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/* -------------------------------------------------------------- */
|
||||||
|
/* new Sun Feb 12 11:30:02 CET 2023 */
|
||||||
|
static int run_rndfluffy(FloatImg *img, int k)
|
||||||
|
{
|
||||||
|
FloatImg tmp;
|
||||||
|
int ret;
|
||||||
|
memset(&tmp, 0, sizeof(FloatImg));
|
||||||
|
fimg_clone(img, &tmp, 0);
|
||||||
|
ret = fimg_make_rndfluffy_lines(img, &tmp, k);
|
||||||
|
fimg_copy_data(&tmp, img);
|
||||||
|
fimg_destroy(&tmp);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
@ -441,10 +455,14 @@ switch (idFx) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CR_gr2popcol:
|
case CR_gr2popcol:
|
||||||
// fprintf(stderr, "******* TO BE DONE ********\n");
|
|
||||||
retval = run_gr2popcol(image, -1);
|
retval = run_gr2popcol(image, -1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CR_fluffy:
|
||||||
|
// fprintf(stderr, "******* TO BE DONE ********\n");
|
||||||
|
retval = run_rndfluffy(image, 75);
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
fprintf(stderr, "%s : effect #%d invalid\n",
|
fprintf(stderr, "%s : effect #%d invalid\n",
|
||||||
__func__, idFx);
|
__func__, idFx);
|
||||||
@ -481,7 +499,7 @@ int idx;
|
|||||||
|
|
||||||
#define OUT stdout
|
#define OUT stdout
|
||||||
|
|
||||||
if (NULL!=texte && verbosity) fprintf(OUT, "___ %s\n ___", texte);
|
if (NULL!=texte && verbosity) fprintf(OUT, "___ %s ___\n", texte);
|
||||||
for (idx=0; CrapL[idx].id!=-1; idx++) {
|
for (idx=0; CrapL[idx].id!=-1; idx++) {
|
||||||
if (verbosity) {
|
if (verbosity) {
|
||||||
fprintf(OUT, " %-12s | %4d | %5d | %8.3f\n",
|
fprintf(OUT, " %-12s | %4d | %5d | %8.3f\n",
|
||||||
|
@ -42,5 +42,6 @@
|
|||||||
50 decrgbzc 1 99
|
50 decrgbzc 1 99
|
||||||
51 decrgbzg 1 99
|
51 decrgbzg 1 99
|
||||||
60 gr2popcol 1 99
|
60 gr2popcol 1 99
|
||||||
|
61 fluffy 1 0.12
|
||||||
99 message 1 1.0
|
99 message 1 1.0
|
||||||
-1 end 1 1.0
|
-1 end 1 1.0
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* https://git.tetalab.org/tTh/FloatImg
|
* https://git.tetalab.org/tTh/FloatImg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FIMG_VERSION (212)
|
#define FIMG_VERSION (219)
|
||||||
#define RELEASE_NAME ("noname")
|
#define RELEASE_NAME ("noname")
|
||||||
|
|
||||||
/* XXX add a test for stdint.h / uint32_t XXX */
|
/* XXX add a test for stdint.h / uint32_t XXX */
|
||||||
@ -174,6 +174,7 @@ int fimg_binarize(FloatImg *pimg, int notused);
|
|||||||
int fimg_trinarize(FloatImg *pimg, int notused);
|
int fimg_trinarize(FloatImg *pimg, int notused);
|
||||||
|
|
||||||
/* module sfx3.c */
|
/* module sfx3.c */
|
||||||
|
int fimg_make_rndfluffy_lines(FloatImg *src, FloatImg *dst, int rndt);
|
||||||
int fimg_crump_hard(FloatImg *src, FloatImg *dst, float kval, int notused);
|
int fimg_crump_hard(FloatImg *src, FloatImg *dst, float kval, int notused);
|
||||||
|
|
||||||
/* module sfx4.c */
|
/* module sfx4.c */
|
||||||
|
40
funcs/sfx3.c
40
funcs/sfx3.c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
@ -16,6 +17,45 @@
|
|||||||
|
|
||||||
extern int verbosity;
|
extern int verbosity;
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------- */
|
||||||
|
/* new Sun 29 Jan 2023 10:01:39 PM CET
|
||||||
|
|
||||||
|
*/
|
||||||
|
int fimg_make_rndfluffy_lines(FloatImg *src, FloatImg *dst, int rndt)
|
||||||
|
{
|
||||||
|
int x, y, ol;
|
||||||
|
float accu;
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, ">>> %s ( '%p' '%p' %d )\n", __func__,
|
||||||
|
src, dst, rndt);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fimg_images_not_compatible(src, dst)) {
|
||||||
|
/* be hard for the lamers */
|
||||||
|
fprintf(stderr, "compatibility OUPS in %s\n", __func__);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (y=0; y<src->height; y++) {
|
||||||
|
ol = y * src->width;
|
||||||
|
if (rndt < (rand() % 100)) {
|
||||||
|
accu = 0.0;
|
||||||
|
for (x=0; x<src->width; x++) accu += src->R[ol + x];
|
||||||
|
accu /= (float)src->width;
|
||||||
|
for (x=0; x<src->width; x++) dst->R[ol + x] = accu;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (x=0; x<src->width; x++) {
|
||||||
|
dst->R[ol+x] = src->R[ol+x];
|
||||||
|
dst->G[ol+x] = src->G[ol+x];
|
||||||
|
dst->B[ol+x] = src->B[ol+x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
int fimg_crump_hard(FloatImg *src, FloatImg *dst, float kval, int notused)
|
int fimg_crump_hard(FloatImg *src, FloatImg *dst, float kval, int notused)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
|||||||
Geometrie, FileType, Mirror, KillRGB,
|
Geometrie, FileType, Mirror, KillRGB,
|
||||||
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
|
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
|
||||||
Rectangle, Dicom, Fakolor0, Fakolor3,
|
Rectangle, Dicom, Fakolor0, Fakolor3,
|
||||||
Fmorpho0 };
|
Fmorpho0, Fluffy };
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int Cmd;
|
int Cmd;
|
||||||
@ -64,6 +64,7 @@ Command commands[] = {
|
|||||||
{ "fakolor0", Fakolor0 },
|
{ "fakolor0", Fakolor0 },
|
||||||
{ "fakolor3", Fakolor3 },
|
{ "fakolor3", Fakolor3 },
|
||||||
{ "fmorpho0", Fmorpho0 },
|
{ "fmorpho0", Fmorpho0 },
|
||||||
|
{ "fluffy", Fluffy },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@ -262,6 +263,9 @@ switch(opt) {
|
|||||||
case Fmorpho0:
|
case Fmorpho0:
|
||||||
foo = essai_fmorpho_0(filename, "/tmp/fmorpho", 0);
|
foo = essai_fmorpho_0(filename, "/tmp/fmorpho", 0);
|
||||||
break;
|
break;
|
||||||
|
case Fluffy:
|
||||||
|
foo = essai_rndfluffy(filename, outfile, 0);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -27,7 +27,6 @@ extern int verbosity;
|
|||||||
/*
|
/*
|
||||||
* nouveau 30 octobre 2022 --> fmorpho.c
|
* nouveau 30 octobre 2022 --> fmorpho.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int essai_fmorpho_0(char *infile, char *basefname, int k)
|
int essai_fmorpho_0(char *infile, char *basefname, int k)
|
||||||
{
|
{
|
||||||
FloatImg src, dst;
|
FloatImg src, dst;
|
||||||
@ -318,6 +317,42 @@ if (foo) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
/* new Sun Feb 12 10:34:06 CET 2023
|
||||||
|
*/
|
||||||
|
int essai_rndfluffy(char *infile, char *outfile, int k)
|
||||||
|
{
|
||||||
|
int foo;
|
||||||
|
FloatImg src, dst;
|
||||||
|
|
||||||
|
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
|
||||||
|
infile, outfile, k);
|
||||||
|
|
||||||
|
foo = fimg_create_from_dump(infile, &src);
|
||||||
|
if (0 != foo) {
|
||||||
|
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
|
||||||
|
foo, infile);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
fprintf(stderr, " %s loaded.\n", infile);
|
||||||
|
|
||||||
|
fimg_clone(&src, &dst, 0);
|
||||||
|
fprintf(stderr, " %p cloned.\n", &src);
|
||||||
|
|
||||||
|
foo = fimg_make_rndfluffy_lines(&src, &dst, 80);
|
||||||
|
if (foo) {
|
||||||
|
fprintf(stderr, "err %d while making fluffy\n", foo);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
|
||||||
|
foo = fimg_export_picture(&dst, outfile, 0);
|
||||||
|
if (foo) {
|
||||||
|
fprintf(stderr, "%s: err %d exporting %s\n", __func__, foo, outfile);
|
||||||
|
return foo;
|
||||||
|
}
|
||||||
|
fimg_destroy(&src); fimg_destroy(&dst);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
int essai_split_level(char *inf, char *outf, int flags)
|
int essai_split_level(char *inf, char *outf, int flags)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ int essai_miroir(char *inf, char *outf, int flags);
|
|||||||
int essai_killrgb(char *inf, char *outf);
|
int essai_killrgb(char *inf, char *outf);
|
||||||
int essai_decomprgb_color(char *inf, char *outf);
|
int essai_decomprgb_color(char *inf, char *outf);
|
||||||
int essai_decomprgb_gray(char *inf, char *outf);
|
int essai_decomprgb_gray(char *inf, char *outf);
|
||||||
|
int essai_rndfluffy(char *infile, char *outfile, int k); /* sfx3.c */
|
||||||
int essai_split_level(char *inf, char *outf, int flags);
|
int essai_split_level(char *inf, char *outf, int flags);
|
||||||
|
|
||||||
int essai_displacement(char *infile, char *outfile);
|
int essai_displacement(char *infile, char *outfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user