forked from tTh/FloatImg
add a new (and funny) contrast adjustement
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user