00001 #ifndef _BicubicImInterpolator_H 00002 #define _BicubicImInterpolator_H 00003 00024 #include <stdio.h> 00025 00026 #include "AnImageInterpolator.hpp" 00027 00028 class BicubicImInterpolator : public AnImageInterpolator 00029 { 00030 private: 00031 00032 int ix, iy; // current reference box corner, if not changed, interpolate without recomputing coeffs! 00033 int ichannel; // changing channel leads to other interpolation 00034 00035 float y[4]; // point corners 00036 float y1[4]; // x gradient 00037 float y2[4]; // y gradient 00038 float y12[4]; // xy cross derivation 00039 00040 float c[4][4]; // bicubic coefficients 00041 00042 public: 00043 00044 const static int wt[16][16]; 00045 00046 protected: 00047 00048 void computeBoxAndGradients(double x, double y, int c=0); // default use central differentials, limiters may help,... 00049 void computeCoefficients(); // assume dx=dy=1.0 00050 00051 public: 00052 00053 BicubicImInterpolator(AnImage* animage=0):AnImageInterpolator(animage){ix=-1; iy=-1; ichannel=-1;} 00054 virtual ~BicubicImInterpolator(){} 00055 00056 virtual int igetR(double x, double y, int c=0); // integer rounding 00057 virtual double getR(double x, double y, int c=0); // interpolated value 00058 }; 00059 00060 #endif