thermocolr updated

This commit is contained in:
tTh
2024-03-27 08:50:17 +01:00
parent 4ecce5bdc0
commit 953462eb6e
3 changed files with 12 additions and 7 deletions

View File

@@ -1192,7 +1192,7 @@ memset(&dst, 0, sizeof(FloatImg));
foo = fimg_clone(&src, &dst, 0);
if (foo) return -888;
fimg_auto_thermique(&src, &dst, 0);
foo = fimg_auto_thermique(&src, &dst, 0);
foo = fimg_export_picture(&dst, outfile, 0);
if (foo) {

View File

@@ -15,7 +15,9 @@
extern int verbosity;
/* --------------------------------------------------------------------- */
/*
* parameter k in not used, but may be in the futur.
*/
int fimg_auto_thermique(FloatImg *src, FloatImg *dst, int k)
{
// int x, y, off;
@@ -29,11 +31,11 @@ fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k);
#endif
if (0!=k) {
fprintf(stderr, "%s: k mus be 0, was %d\n", __func__, k);
fprintf(stderr, "%s: k must be 0, was %d\n", __func__, k);
}
surface = src->width * src->height;
fprintf(stderr, "surface = %d\n", surface);
// fprintf(stderr, "surface = %d\n", surface);
graymean = 0.0;
for (idx=0; idx<surface; idx++) {
@@ -43,6 +45,9 @@ for (idx=0; idx<surface; idx++) {
seuil = (float) (graymean / surface);
// fprintf(stderr, "graymean = %f seuil = %f\n", graymean, seuil);
/*
* please, explain this number brotching
*/
for (idx=0; idx<surface; idx++) {
gray = src->R[idx] + src->G[idx] + src->B[idx];
if (gray > seuil) {