a new "rescale" option in cumulfimgs
This commit is contained in:
@@ -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 !
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user