more clenaup, expect more bugs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* classif.c
|
||||
* Detection de contours
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -26,7 +26,7 @@ int tbl[] = /* deep magic inside */
|
||||
1, 1, 0, 1,
|
||||
1, 0, 1, 1,
|
||||
1, 1, 1, 0
|
||||
};
|
||||
}; /* please explain */
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, reverse);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* nouveau 24 octobre 2020, pendant le masque-flamme coronavidique */
|
||||
|
||||
@@ -48,7 +47,11 @@ dltg = minmax[3] - minmax[2];
|
||||
dltb = minmax[5] - minmax[4];
|
||||
|
||||
in = out = 0;
|
||||
|
||||
/*
|
||||
* BE WARNED !
|
||||
* This code doesn't work as expected, so I have to
|
||||
* rewrite it, maybe when the pandemic is closed...
|
||||
*/
|
||||
for (y=0; y<psrc->height; y++) {
|
||||
|
||||
for (x=0; x<psrc->width; x++) {
|
||||
|
||||
@@ -26,45 +26,36 @@ fprintf(stderr, ">>> %s ( %p '%s' 0x%X )\n", __func__,
|
||||
|
||||
filetype = format_from_extension(fname);
|
||||
if (verbosity > 1) {
|
||||
fprintf(stderr, "file %s : type %d\n", fname, filetype);
|
||||
fprintf(stderr, "file %s have 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;
|
||||
|
||||
case FILE_TYPE_BMP:
|
||||
fprintf(stderr, "%s: file type BMP not implemented\n", __func__);
|
||||
foo = -666;
|
||||
|
||||
default:
|
||||
foo = -1789;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (foo) {
|
||||
|
||||
@@ -26,6 +26,10 @@ if (dst->type != FIMG_TYPE_RGB) {
|
||||
fprintf(stderr, "%s: dst type %d invalid\n", __func__, dst->type);
|
||||
return -99;
|
||||
}
|
||||
if (fimg_images_not_compatible(src, dst)) {
|
||||
fprintf(stderr, "%s: src & dst not comatibles\n", __func__);
|
||||
return -98;
|
||||
}
|
||||
|
||||
/* aliasing some vars for cleaner code */
|
||||
pr = src->R; pg = src->G; pb = src->B;
|
||||
@@ -146,7 +150,6 @@ h = img->height; w = img->width;
|
||||
for (idx=0; idx<h; idx++) {
|
||||
|
||||
#define FAST 1
|
||||
|
||||
#if FAST
|
||||
img->R[idx*w] = 0.0;
|
||||
img->G[idx*w] = 0.0;
|
||||
|
||||
@@ -43,7 +43,6 @@ switch (plane) {
|
||||
return -66;
|
||||
}
|
||||
|
||||
|
||||
remove(outname); /* Delete old file if it already exists */
|
||||
if (fits_create_file(&fptr, outname, &status)) {
|
||||
fits_report_error(stderr, status);
|
||||
@@ -53,7 +52,6 @@ if (fits_create_file(&fptr, outname, &status)) {
|
||||
naxes[0] = src->width; naxes[1] = src->height;
|
||||
if (verbosity) fimg_describe(src, "to be saved as FITS");
|
||||
|
||||
|
||||
if ( fits_create_img(fptr, bitpix, naxis, naxes, &status) ) {
|
||||
fits_report_error(stderr, status);
|
||||
return -10;
|
||||
|
||||
@@ -54,9 +54,9 @@ TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 3); // RGB
|
||||
TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 16); // 0->65535
|
||||
|
||||
TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
||||
TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
||||
|
||||
sprintf(ligne, "lib FloatImg %d by tTh", FIMG_VERSION);
|
||||
sprintf(ligne, "lib FloatImg v %d by tTh", FIMG_VERSION);
|
||||
TIFFSetField(tiff, TIFFTAG_SOFTWARE, ligne);
|
||||
|
||||
foo = src->width * 3;
|
||||
@@ -66,7 +66,6 @@ if (verbosity) fprintf(stderr, "default strip size %d\n", foo);
|
||||
TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, foo);
|
||||
|
||||
for (y=0; y<src->height; y++) {
|
||||
|
||||
ptr = linebuff;
|
||||
idx = y * src->width;
|
||||
|
||||
@@ -78,7 +77,6 @@ for (y=0; y<src->height; y++) {
|
||||
}
|
||||
|
||||
TIFFWriteScanline(tiff, linebuff, y, 0);
|
||||
|
||||
idx += src->width;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ float rgb[3], moy;
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, ghist, sz);
|
||||
#endif
|
||||
|
||||
if (FIMG_TYPE_RGB != src->type) {
|
||||
fprintf(stderr, "%s: bad type %d of image\n", __func__, src->type);
|
||||
return -97;
|
||||
}
|
||||
|
||||
maxval = fimg_get_maxvalue(src);
|
||||
|
||||
fprintf(stderr, "maximum is %f\n", maxval);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
testing some random funcs.
|
||||
|
||||
*/
|
||||
* This is an eternal WIP, sorry...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -56,7 +55,6 @@ for (x=0; x<fimg->width; x++) {
|
||||
// fprintf(stderr, " %6d %f\n", x, val);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -88,14 +86,14 @@ for (y=1; y<fimg->height; y++) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_multirandom(FloatImg *fimg)
|
||||
int fimg_multirandom(FloatImg *fimg, long nbpass)
|
||||
{
|
||||
int foo, x, y;
|
||||
|
||||
#define RI ( (rand()/7) + (rand()/9) )
|
||||
#define RD ( (drand48()/7) + (drand48()/7) )
|
||||
|
||||
for (foo=0; foo<100000000; foo++)
|
||||
for (foo=0; foo<nbpass; foo++)
|
||||
{
|
||||
x = RI % fimg->width;
|
||||
y = RI % fimg->height;
|
||||
|
||||
@@ -34,7 +34,7 @@ return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* wtf ? ther's no way to have the black at the bottom ?
|
||||
* To have the black at the bottom, use a negative dcoef
|
||||
*/
|
||||
int fimg_vdeg_a(FloatImg *img, double dcoef)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,9 @@ for (foo=0; foo<nbpix; foo++) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* parameter fval is not used, why ?
|
||||
*/
|
||||
int fimg_killcolors_b(FloatImg *fimg, float fval)
|
||||
{
|
||||
int nbpix, foo;
|
||||
|
||||
@@ -145,12 +145,10 @@ opt = lookup_cmd(command);
|
||||
switch(opt) {
|
||||
case Equalize:
|
||||
foo = essai_equalize(filename); break;
|
||||
|
||||
case Sfx0:
|
||||
foo = essai_sfx0(filename); break;
|
||||
case F3x3:
|
||||
foo = essai_filtrage_3x3(filename); break;
|
||||
|
||||
case MIRE:
|
||||
foo = essai_mire(filename, 0);
|
||||
break;
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
extern int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
*/
|
||||
|
||||
int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef)
|
||||
{
|
||||
FloatImg src, dst;
|
||||
@@ -273,6 +272,9 @@ else {
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX need more work on this function !
|
||||
*/
|
||||
foo = fimg_equalize_compute(&src, NULL, 666.666);
|
||||
fprintf(stderr, "equalize compute --> %d\n", foo);
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
/*
|
||||
* FloatImg from tTh - 2021
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -15,7 +17,6 @@ fprintf(stderr, "\t\tminmax %s\n", titre);
|
||||
fprintf(stderr, "red\t\t%10f %10f\n", minmax[0], minmax[1]);
|
||||
fprintf(stderr, "green\t\t%10f %10f\n", minmax[2], minmax[3]);
|
||||
fprintf(stderr, "blue\t\t%10f %10f\n", minmax[4], minmax[5]);
|
||||
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int parse_WxH(char *str, int *pw, int *ph)
|
||||
@@ -33,7 +34,6 @@ if (2 != foo) {
|
||||
fprintf(stderr, "%s : arg '%s' is invalid\n", __func__, str);
|
||||
return foo;
|
||||
}
|
||||
|
||||
*pw = w; *ph = h;
|
||||
|
||||
return 2;
|
||||
|
||||
Reference in New Issue
Block a user