4 changed files with 91 additions and 11 deletions
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <string.h> |
||||
#include <math.h> |
||||
|
||||
#include "../floatimg.h" |
||||
|
||||
int verbosity; |
||||
|
||||
/* ---------------------------------------------------------------- */ |
||||
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 * 2; |
||||
|
||||
for (idx=0; idx<picsize; idx++) { |
||||
|
||||
d->R[idx] = (coef * s1->R[idx]) + ((1.0-coef) * s2->R[idx]); |
||||
|
||||
} |
||||
|
||||
return -1; |
||||
} |
||||
/* ---------------------------------------------------------------- */ |
Loading…
Reference in new issue