Compare commits
3 Commits
0e00e00df5
...
e9ca450584
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e9ca450584 | ||
![]() |
3fd604b14a | ||
![]() |
0169fbade7 |
@ -13,12 +13,34 @@
|
|||||||
|
|
||||||
int verbosity;
|
int verbosity;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------- */
|
||||||
|
/* for debug purpose */
|
||||||
|
int printf_histo_gray(char *fname, int histo[], int nbre)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
#if DEBUG_LEVEL
|
||||||
|
fprintf(stderr, ">>> %s ( '%s' %p %d )\n", __func__,
|
||||||
|
fname, histo, nbre);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (NULL == (fp = fopen(fname, "w"))) {
|
||||||
|
perror(fname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (idx=0; idx<nbre; idx++) {
|
||||||
|
fprintf(fp, "%6d %8d\n", idx, histo[idx]);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
/* for debug purpose */
|
/* for debug purpose */
|
||||||
int calcul_histo_gray(FloatImg *img, char *fname, int nbslots, float *pmax)
|
int calcul_histo_gray(FloatImg *img, char *fname, int nbslots, float *pmax)
|
||||||
{
|
{
|
||||||
int offset, nbpix, ival;
|
int offset, nbpix, ival;
|
||||||
FILE *fp;
|
|
||||||
float pixel, minp, maxp;
|
float pixel, minp, maxp;
|
||||||
int *counts;
|
int *counts;
|
||||||
|
|
||||||
@ -59,14 +81,10 @@ for (offset=0; offset<nbpix; offset++) {
|
|||||||
// fprintf(stderr, "%6d %10.6f %i\n", offset, pixel, ival);
|
// fprintf(stderr, "%6d %10.6f %i\n", offset, pixel, ival);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == (fp = fopen(fname, "w"))) {
|
if (NULL != fname)
|
||||||
perror(fname);
|
{
|
||||||
exit(1);
|
printf_histo_gray(fname, counts, nbslots);
|
||||||
}
|
}
|
||||||
for (ival=0; ival<nbslots; ival++) {
|
|
||||||
fprintf(fp, "%6d %8d\n", ival, counts[ival]);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
/* garbage collect stuff */
|
/* garbage collect stuff */
|
||||||
free(counts);
|
free(counts);
|
||||||
|
@ -64,7 +64,7 @@ if (fimg_images_not_compatible(src, dst)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verbosity > 1) {
|
if (verbosity > 1) {
|
||||||
fimg_show_filter("essai", filtr);
|
fimg_show_filter(__func__, filtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aliasing some vars for cleaner code */
|
/* aliasing some vars for cleaner code */
|
||||||
|
@ -396,6 +396,8 @@ if (fi->type != FIMG_TYPE_RGB) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nbre = fi->width * fi->height;
|
nbre = fi->width * fi->height;
|
||||||
|
// fprintf(stderr, "%s: %d pixels\n", __func__, nbre);
|
||||||
|
|
||||||
for (idx=0; idx<nbre; idx++) {
|
for (idx=0; idx<nbre; idx++) {
|
||||||
fi->R[idx] = drand48() * kmul;
|
fi->R[idx] = drand48() * kmul;
|
||||||
fi->G[idx] = drand48() * kmul;
|
fi->G[idx] = drand48() * kmul;
|
||||||
|
Loading…
Reference in New Issue
Block a user