tweaking
This commit is contained in:
parent
99bbd20b47
commit
cd6f045789
@ -20,7 +20,6 @@ int calcul_histo_gray(FloatImg *img, char *fname, int nbslots, float *pmax)
|
||||
int offset, nbpix, ival;
|
||||
FILE *fp;
|
||||
float pixel, minp, maxp;
|
||||
|
||||
int *counts;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
@ -29,6 +28,7 @@ fprintf(stderr, ">>> %s ( %p '%s' %d )\n", __func__,
|
||||
#endif
|
||||
|
||||
if (FIMG_TYPE_GRAY != img->type) {
|
||||
fprintf(stderr, "%s: image is not in greylevel\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ if (NULL == (fp = fopen(fname, "w"))) {
|
||||
exit(1);
|
||||
}
|
||||
for (ival=0; ival<nbslots; ival++) {
|
||||
fprintf(fp, "%6d %6d\n", ival, counts[ival]);
|
||||
fprintf(fp, "%6d %8d\n", ival, counts[ival]);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
@ -90,6 +90,15 @@ float pente, minp, maxp, seuil;
|
||||
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* trying some preprocessor filters
|
||||
*/
|
||||
//foo = fimg_lissage_2x2(src);
|
||||
foo = fimg_lissage_3x3(src);
|
||||
if (foo) fprintf(stderr, " lissage -> %d\n", foo);
|
||||
foo = fimg_killborders(src);
|
||||
if (foo) fprintf(stderr, " killborder -> %d\n", foo);
|
||||
|
||||
#define W (src->width)
|
||||
#define DX 1.0
|
||||
#define DY 1.0
|
||||
@ -122,7 +131,7 @@ if (foo) fprintf(stderr, "<<< calcul histo -> %d\n", foo);
|
||||
|
||||
|
||||
minp = 1e10;
|
||||
seuil = 0.640 * maxp;
|
||||
seuil = 0.700 * maxp;
|
||||
fprintf(stderr, " seuil = %f\n", seuil);
|
||||
|
||||
for (offset=0; offset<(src->width*src->height); offset++) {
|
||||
@ -132,7 +141,7 @@ for (offset=0; offset<(src->width*src->height); offset++) {
|
||||
}
|
||||
if (pente > maxp) maxp = pente;
|
||||
}
|
||||
fprintf(stderr, "minp --> %f maxp --> %f\n", minp, maxp);
|
||||
// fprintf(stderr, " minp = %f maxp = %f\n", minp, maxp);
|
||||
|
||||
/* recopie dans l'image destination avec translation hauteur */
|
||||
for (offset=0; offset<(src->width*src->height); offset++) {
|
||||
@ -143,6 +152,9 @@ for (offset=0; offset<(src->width*src->height); offset++) {
|
||||
dst->B[offset] = pente;
|
||||
}
|
||||
|
||||
foo = fimg_killborders(dst);
|
||||
if (foo) fprintf(stderr, " killborder -> %d\n", foo);
|
||||
|
||||
/* clean the memory */
|
||||
fimg_destroy(&tmp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user