Compare commits

..

No commits in common. "29480bfdfdbf944a7ea09a70c4c3b7d9f8943b1a" and "9fda48ab304a920629d1337d6004ae31972c7307" have entirely different histories.

6 changed files with 16 additions and 105 deletions

View File

@ -109,10 +109,6 @@ int fimg_colors_mixer_a(FloatImg *fimg, float fval);
/* #coronamaison */ /* #coronamaison */
int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused); int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused);
/* universal exporter XXX */
int fimg_export_picture(FloatImg *pic, char *fname, int flags);
/* PNM files module */ /* PNM files module */
int fimg_save_as_pnm(FloatImg *head, char *fname, int flags); int fimg_save_as_pnm(FloatImg *head, char *fname, int flags);
int fimg_load_from_pnm(char *fname, FloatImg *head, int notused); int fimg_load_from_pnm(char *fname, FloatImg *head, int notused);

View File

@ -5,7 +5,7 @@ DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \ fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \
equalize.o fimg-fits.o saturation.o histogram.o \ equalize.o fimg-fits.o saturation.o histogram.o \
hsv.o classif.o contour2x2.o qsortrgb.o exporter.o hsv.o classif.o contour2x2.o qsortrgb.o
#--------------------------------------------------------------- #---------------------------------------------------------------
@ -67,9 +67,6 @@ classif.o: classif.c $(DEPS)
qsortrgb.o: qsortrgb.c $(DEPS) qsortrgb.o: qsortrgb.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<
exporter.o: exporter.c $(DEPS)
gcc $(COPT) -c $<
hsv.o: hsv.c $(DEPS) hsv.o: hsv.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

View File

@ -9,7 +9,7 @@
#include "../floatimg.h" #include "../floatimg.h"
extern int verbosity; int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */ /* nouveau 2 octobre 2020, juste avant sonoptic de la pluie craignos */

View File

@ -9,7 +9,7 @@
#include "../floatimg.h" #include "../floatimg.h"
extern int verbosity; int verbosity;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* nouveau 4 octobre 2020, juste avant sonoptic de la pluie craignos */ /* nouveau 4 octobre 2020, juste avant sonoptic de la pluie craignos */
@ -41,6 +41,7 @@ if (fimg_images_not_compatible(psrc, pdst)) {
return -8; return -8;
} }
if (reverse) { if (reverse) {
v1 = 0.0; v2 = 1.0; v1 = 0.0; v2 = 1.0;
} }

View File

@ -1,75 +0,0 @@
/*
* exporter.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../floatimg.h"
extern int verbosity;
/* --------------------------------------------------------------------- */
/*
* multi-magic 'save file' function.
*/
int fimg_export_picture(FloatImg *pic, char *fname, int flags)
{
int filetype;
int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p '%s' 0x%X )\n", __func__,
pic, fname, flags);
#endif
filetype = format_from_extension(fname);
if (verbosity) {
fprintf(stderr, "file %s : type %d\n", fname, filetype);
}
switch(filetype) {
case FILE_TYPE_FIMG:
foo = fimg_dump_to_file(pic, fname, 0);
break;
case FILE_TYPE_PNM:
foo = fimg_save_as_pnm(pic, fname, 0);
break;
case FILE_TYPE_PNG:
foo = fimg_save_as_png(pic, fname, 0);
break;
case FILE_TYPE_TGA:
fprintf(stderr, "%s: FILE_TYPE_TGA not implemented\n",
__func__);
foo = -666;
break;
case FILE_TYPE_TIFF:
foo = fimg_write_as_tiff(pic, fname, 0);
break;
case FILE_TYPE_FITS:
foo = fimg_save_R_as_fits(pic, fname, 0);
break;
default:
foo = -1789;
break;
}
if (foo) {
fprintf(stderr, "%s: exporting '%s' -> %d\n", __func__,
fname, foo);
/* que faire maintenant ? */
}
return foo;
}
/* --------------------------------------------------------------------- */

View File

@ -45,7 +45,7 @@ if (foo) {
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out.pnm", 0); foo = fimg_dump_to_file(&dst, "out.fimg", 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -58,9 +58,6 @@ return 0;
/* /*
* nouveau 5 octobre 2020 pendant sonoptic * nouveau 5 octobre 2020 pendant sonoptic
*/ */
int essai_contour_2x2(char *infile) int essai_contour_2x2(char *infile)
{ {
FloatImg src, dst; FloatImg src, dst;
@ -81,13 +78,13 @@ else {
fimg_clone(&src, &dst, 1); fimg_clone(&src, &dst, 1);
foo = fimg_contour_2x2(&src, &dst, 0); foo = fimg_contour_2x2(&src, &dst, 1);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d in contour_2x2\n", __func__, foo); fprintf(stderr, "%s: err %d in contour_2x2\n", __func__, foo);
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out2x2.pnm", 0); foo = fimg_save_as_pnm(&dst, "out.pnm", 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -127,7 +124,7 @@ if (foo) {
return foo; return foo;
} }
foo = fimg_export_picture(&dst, "out.pnm", 0); foo = fimg_save_as_pnm(&dst, "out.pnm", 0);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo); fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo; return foo;
@ -225,8 +222,8 @@ fimg_save_as_png(&src, "test.png", 0);
foo = fimg_rotate_90(&src, &dst, 0); foo = fimg_rotate_90(&src, &dst, 0);
fprintf(stderr, "rotate 90 -> %d\n", foo); fprintf(stderr, "rotate 90 -> %d\n", foo);
foo = fimg_export_picture(&dst, "rotated90.png", 0); foo = fimg_save_as_png(&dst, "rotated90.png", 0);
foo = fimg_export_picture(&dst, "rotated90.pnm", 0); foo = fimg_save_as_pnm(&dst, "rotated90.pnm", 0);
fimg_destroy(&src); fimg_destroy(&src);
@ -482,7 +479,7 @@ re = fimg_test_pattern(&fimg, 9, 1.0);
if (re) { if (re) {
fprintf(stderr, "fimg_test_pattern -> %d\n", re); fprintf(stderr, "fimg_test_pattern -> %d\n", re);
} }
fimg_export_picture(&fimg, "mire.pnm", 0); fimg_save_as_pnm(&fimg, "mire.pnm", 0);
return -1; return -1;
} }
@ -528,6 +525,7 @@ return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */ int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
int fimg_essai_hsv(char *fname); /* hsv.c */ int fimg_essai_hsv(char *fname); /* hsv.c */
@ -600,10 +598,7 @@ void help(int k)
{ {
Command *pcmd; Command *pcmd;
fprintf(stderr, "usage:\n\t./t [options] command filename\n"); fprintf(stderr, "usage:\n\t./t command filename\n");
fprintf(stderr, "options:\n");
fprintf(stderr, "\t-o outfile\n");
fprintf(stderr, "commands:\n"); fprintf(stderr, "commands:\n");
pcmd = commands; pcmd = commands;
@ -619,19 +614,16 @@ exit(0);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo, opt; int foo, opt;
char *filename, *command, *outfile; char *filename, *command;
fprintf(stderr, "++++++++ test des fonctions pid=%d\n", getpid()); fprintf(stderr, "++++++++ test des fonctions pid=%d\n", getpid());
global_fvalue = 1.0; global_fvalue = 1.0;
outfile = "out.pnm";
while ((opt = getopt(argc, argv, "hk:v")) != -1) {
while ((opt = getopt(argc, argv, "hk:p:v")) != -1) {
switch(opt) { switch(opt) {
case 'h': help(0); break; case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break; case 'k': global_fvalue = atof(optarg); break;
case 'o': outfile = optarg; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
} }
} }