a new function

This commit is contained in:
Tonton Th 2020-08-06 13:13:10 +02:00
parent 0d93070774
commit 0651d8de7a
2 changed files with 23 additions and 0 deletions

View File

@ -122,6 +122,7 @@ int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
int fimg_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
/* module funcs/geometry.c */

View File

@ -41,4 +41,26 @@ for (y=0; y<img->height; y++) {
return 0;
}
/* -------------------------------------------------------------- */
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6])
{
int sz, idx;
sz = s->width * s->height;
if (FIMG_TYPE_RGB != img->type) {
fprintf(stderr, "%s bad type\n", __func__);
return -6;
}
for (idx=0; idx<sz; idx++) {
d->R[idx] = s->R[idx] - coefs[0];
d->G[idx] = s->G[idx] - coefs[2];
d->B[idx] = s->B[idx] - coefs[4];
}
return 0;
}
/* -------------------------------------------------------------- */