add a new (and funny) contrast adjustement

This commit is contained in:
2019-12-03 14:25:30 +01:00
parent 116cb56e13
commit de3b31db94
5 changed files with 50 additions and 9 deletions

View File

@@ -132,6 +132,38 @@ for (idx=0; idx<nbre; idx++) {
return 0;
}
/* ---------------------------------------------------------------- */
int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval)
{
int nbre, idx;
double dval;
if (s->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : type %d invalide\n",
__func__, s->type);
return -4;
}
if (NULL==d) {
d = s;
}
else {
if (d->type != FIMG_TYPE_RGB) {
fprintf(stderr, "%s : dst type %d invalide\n",
__func__, d->type);
return -4;
}
}
nbre = s->width * s->height * 3;
for (idx=0; idx<nbre; idx++) {
dval = s->R[idx] / maxval;
d->R[idx] = maxval * (0.5 - 0.5 * cos(2*3.141592654*dval));
}
return 0;
}
/* ---------------------------------------------------------------- */