a new "rescale" option in cumulfimgs

This commit is contained in:
tTh
2022-09-17 19:18:45 +02:00
parent e6379f6338
commit feafd2799d
3 changed files with 51 additions and 14 deletions

View File

@@ -296,6 +296,33 @@ if (fi->type == FIMG_TYPE_GRAY) {
return 0;
}
/* ---------------------------------------------------------------- */
/* nouveau 17 septembre 2022 */
int fimg_div_cste(FloatImg *fi, float value)
{
int nbre, idx;
if ( (fi->type != FIMG_TYPE_RGB) && (fi->type != FIMG_TYPE_GRAY) ) {
fprintf(stderr, "%s : type %d invalide\n",
__func__, fi->type);
return -44;
}
nbre = fi->width * fi->height;
if (fi->type == FIMG_TYPE_RGB) {
for (idx=0; idx<nbre; idx++) {
fi->R[idx] /= value;
fi->G[idx] /= value;
fi->B[idx] /= value;
}
}
if (fi->type == FIMG_TYPE_GRAY) {
for (idx=0; idx<nbre; idx++) {
fi->R[idx] /= value;
}
}
return 0;
}
/* ---------------------------------------------------------------- */
/*
* oh, please explain the usecase of this function !
*/