Compare commits
No commits in common. "7718ca0f62dd255c5852c539b15e578f3fda9333" and "b8a4514773593042071348b00d87f075d21742a2" have entirely different histories.
7718ca0f62
...
b8a4514773
@ -4,7 +4,7 @@
|
||||
* http://la.buvette.org/photos/cumul
|
||||
*/
|
||||
|
||||
#define FIMG_VERSION 132
|
||||
#define FIMG_VERSION 131
|
||||
|
||||
/*
|
||||
* in memory descriptor
|
||||
@ -158,7 +158,6 @@ int fimg_desaturate(FloatImg *src, FloatImg *dst, int notused);
|
||||
|
||||
/* module funcs/geometry.c */
|
||||
int fimg_halfsize_0(FloatImg *src, FloatImg *dst, int notused);
|
||||
int fimg_halfsize_1(FloatImg *src, FloatImg *dst, int notused);
|
||||
|
||||
int fimg_displacement_0(FloatImg *psrc, FloatImg *pdst, int flags);
|
||||
|
||||
|
@ -26,7 +26,7 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
/* no magic check here ? */
|
||||
if (dst->width || dst->height) {
|
||||
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
|
||||
fimg_describe(dst, "destination halfsize 0");
|
||||
fimg_describe(dst, "destination halfsize");
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -55,51 +55,3 @@ for (y=0; y<hd; y++) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int fimg_halfsize_1(FloatImg *src, FloatImg *dst, int notused)
|
||||
{
|
||||
int wd, hd;
|
||||
int foo, x, y, x2, y2;
|
||||
float ac;
|
||||
|
||||
if (dst->width || dst->height) {
|
||||
fprintf(stderr, "*** %s: image at %p not empty\n", __func__, dst);
|
||||
fimg_describe(dst, "destination halfsize 1");
|
||||
return -2;
|
||||
}
|
||||
|
||||
wd = src->width / 2; hd = src->height / 2;
|
||||
if ( (foo = fimg_create(dst, wd, hd, FIMG_TYPE_RGB)) ) {
|
||||
fprintf(stderr, "%s: err create %d\n", __func__, foo);
|
||||
return -3;
|
||||
}
|
||||
|
||||
#define WS (src->width)
|
||||
#define WD (dst->width)
|
||||
|
||||
for (y=0; y<hd; y++) {
|
||||
y2 = y * 2;
|
||||
for (x=0; x<wd; x++) {
|
||||
x2 = x * 2;
|
||||
|
||||
ac = src->R[(y2*WS)+x2] + src->R[(y2*WS)+x2+1] +
|
||||
src->R[((1+y2)*WS)+x2] + src->R[((1+y2)*WS)+x2+1];
|
||||
dst->R[y*WD +x] = ac / 4.0;
|
||||
|
||||
ac = src->G[(y2*WS)+x2] + src->G[(y2*WS)+x2+1] +
|
||||
src->G[((1+y2)*WS)+x2] + src->G[((1+y2)*WS)+x2+1];
|
||||
dst->G[y*WD +x] = ac / 4.0;
|
||||
|
||||
ac = src->B[(y2*WS)+x2] + src->B[(y2*WS)+x2+1] +
|
||||
src->B[((1+y2)*WS)+x2] + src->B[((1+y2)*WS)+x2+1];
|
||||
dst->B[y*WD +x] = ac / 4.0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#undef WS
|
||||
#undef WD
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
@ -21,8 +21,7 @@ float global_fvalue;
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
|
||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
||||
Geometrie };
|
||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@ -47,7 +46,6 @@ Command commands[] = {
|
||||
{ "plasma", Plasmas },
|
||||
{ "hilight", Hilight },
|
||||
{ "openexr", OpenEXR },
|
||||
{ "geometrie", Geometrie, },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
|
||||
@ -204,9 +202,6 @@ switch(opt) {
|
||||
case OpenEXR:
|
||||
foo = essai_openexr(filename, outfile, 0x55);
|
||||
break;
|
||||
case Geometrie:
|
||||
foo = essai_geometrie(filename, 0);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "'%s' is a bad command\n", command);
|
||||
exit(1);
|
||||
|
@ -498,7 +498,7 @@ fimg_destroy(&fimg);
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_geometrie(char *infile, int notused)
|
||||
int essai_geometrie(char *infile)
|
||||
{
|
||||
FloatImg fimg, result;
|
||||
int foo;
|
||||
@ -516,29 +516,19 @@ else {
|
||||
fimg_draw_something(&fimg);
|
||||
}
|
||||
|
||||
// foo = fimg_save_as_pnm(&fimg, "source.pnm", 0);
|
||||
foo = fimg_save_as_pnm(&fimg, "source.pnm", 0);
|
||||
|
||||
memset(&result, 0, sizeof(FloatImg));
|
||||
|
||||
foo = fimg_halfsize_0(&fimg, &result, 0);
|
||||
fprintf(stderr, "retour halfsize 0 -> %d\n", foo);
|
||||
fprintf(stderr, "retour halfsize -> %d\n", foo);
|
||||
if (foo) {
|
||||
return -2;
|
||||
}
|
||||
if (verbosity) fimg_describe(&result, "result after halfsize 0");
|
||||
foo = fimg_save_as_pnm(&result, "halfsize0.pnm", 0);
|
||||
|
||||
fimg_destroy(&result);
|
||||
foo = fimg_halfsize_1(&fimg, &result, 0);
|
||||
fprintf(stderr, "retour halfsize 1 -> %d\n", foo);
|
||||
if (foo) {
|
||||
return -2;
|
||||
}
|
||||
if (verbosity) fimg_describe(&result, "result after halfsize 1");
|
||||
foo = fimg_save_as_pnm(&result, "halfsize1.pnm", 0);
|
||||
if (verbosity) fimg_describe(&result, "result after halfsize");
|
||||
|
||||
/* hop, un peu de nettoyage */
|
||||
fimg_destroy(&result); fimg_destroy(&fimg);
|
||||
foo = fimg_save_as_pnm(&result, "something.pnm", 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ int essai_ecriture_tiff(char *infile);
|
||||
int fimg_essai_hsv(char *infile);
|
||||
int essai_classif(char *infile, char *outfile, float fvalue);
|
||||
int essai_contour_2x2(char *filename, char *outfile);
|
||||
int essai_geometrie(char *infile, int notused);
|
||||
|
||||
int fimg_essai_histo(FloatImg *src, char *outpic, int k); /* histogram.c */
|
||||
int essai_histogramme(char *fname, int k);
|
||||
|
@ -24,15 +24,15 @@ if (foo) {
|
||||
}
|
||||
|
||||
memset(&dst, 0, sizeof(FloatImg));
|
||||
foo = fimg_halfsize_1(&src, &dst, 0);
|
||||
foo = fimg_halfsize_0(&src, &dst, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "halfize 1 fail -> %d\n", foo);
|
||||
fprintf(stderr, "halfize fail -> %d\n", foo);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (to_gray) {
|
||||
foo = fimg_to_gray(&dst);
|
||||
/* and ? */
|
||||
|
||||
}
|
||||
|
||||
foo = fimg_dump_to_file(&dst, oname, 0);
|
||||
@ -47,10 +47,7 @@ return -1;
|
||||
/* ------------------------------------------------------------- */
|
||||
void help(int u)
|
||||
{
|
||||
puts("Usage:\n\tfimghalfsize [options] in.fimg out.fimg");
|
||||
puts("Options:");
|
||||
puts("\t-g\tconvert output to gray");
|
||||
exit(0);
|
||||
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user