51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
#include "../floatimg.h"
|
|
|
|
int verbosity;
|
|
|
|
/* ---------------------------------------------------------------- */
|
|
static int gray_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef)
|
|
{
|
|
return -1;
|
|
}
|
|
/* ---------------------------------------------------------------- */
|
|
|
|
int fimg_interpolate(FloatImg *s1, FloatImg *s2, FloatImg *d, float coef)
|
|
{
|
|
int picsize, idx;
|
|
|
|
if (FIMG_TYPE_RGB != s1->type) {
|
|
fprintf(stderr, "%s : bad src 1 type %d on %p\n", __func__,
|
|
s1->type, s1);
|
|
return -8;
|
|
}
|
|
|
|
if (FIMG_TYPE_RGB != s2->type) {
|
|
fprintf(stderr, "%s : bad src 2 type %d on %p\n", __func__,
|
|
s2->type, s2);
|
|
return -8;
|
|
}
|
|
if (FIMG_TYPE_RGB != d->type) {
|
|
fprintf(stderr, "%s : bad dst type %d on %p\n", __func__,
|
|
d->type, d);
|
|
return -9;
|
|
}
|
|
|
|
picsize = d->width * d->height * 3;
|
|
|
|
for (idx=0; idx<picsize; idx++) {
|
|
|
|
d->R[idx] = (coef * s1->R[idx]) + ((1.0-coef) * s2->R[idx]);
|
|
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
/* ---------------------------------------------------------------- */
|