dicinterpHermite.hpp¶
-
class Hermite : public Interpolator¶
Public Functions
-
Hermite(double *img, int px_hori, int px_vert)¶
Initializes the bicubic interpolator with deformed image data.
Sets up the necessary data structures and computes derivatives required for bicubic interpolation.
- Parameters:
img – Pointer to the image data array
px_hori – Width of the image in pixels
px_vert – Height of the image in pixels
-
virtual double eval(const int ss_x, const int ss_y, const double subpx_x, const double subpx_y) const override¶
Evaluates the bicubic interpolation at a specified point.
Computes the interpolated value at (x,y) using bicubic interpolation from the surrounding pixel values.
- Parameters:
x – The x-coordinate of the interpolation point
y – The y-coordinate of the interpolation point
- Returns:
The interpolated value at (x,y)
-
virtual double eval_dx(const int ss_x, const int ss_y, const double subpx_x, const double subpx_y) const override¶
Evaluates the x-derivative of bicubic interpolation at a specified point.
Computes the partial derivative with respect to x at point (x,y).
- Parameters:
x – The x-coordinate of the point
y – The y-coordinate of the point
- Returns:
The x-derivative of the interpolated function at (x,y)
-
virtual double eval_dy(const int ss_x, const int ss_y, const double subpx_x, const double subpx_y) const override¶
Evaluates the y-derivative of bicubic interpolation at a specified point.
Computes the partial derivative with respect to y at point (x,y).
- Parameters:
x – The x-coordinate of the point
y – The y-coordinate of the point
- Returns:
The y-derivative of the interpolated function at (x,y)
-
virtual InterpVals eval_and_derivs(const int ss_x, const int ss_y, const double subpx_x, const double subpx_y) const override¶
Evaluates the bicubic interpolation and its derivatives at a specified point.
Computes the interpolated value and its partial derivatives at (x,y) in a single call.
- Parameters:
x – The x-coordinate of the point
y – The y-coordinate of the point
- Returns:
Data struct containing the interpolated value and its x and y derivatives
Private Functions
-
inline void coeff_calc(std::vector<double> &tridiag_solution, double dy, double dx, size_t index, double *b, double *c, double *d)¶
Calculates the coefficients for cubic spline interpolation.
Computes the coefficients b, c, and d for the cubic spline polynomial.
- Parameters:
tridiag_solution – The solution vector from the tridiagonal system
dy – Difference in function values
dx – Difference in x values
index – Current index in the data array
b – Pointer to store the computed b coefficient
c – Pointer to store the computed c coefficient
d – Pointer to store the computed d coefficient
-
inline void index_lookup_xy(const int ss_x, const int ss_y, size_t &xi, size_t &yi, const double subpx_x, const double subpx_y) const¶
-
inline int index_lookup(const std::vector<double> &px, double x) const¶
Finds the index of the pixel that contains the given coordinate.
Determines the lower index of the interval containing the specified value.
- Parameters:
px – Vector of pixel coordinates
x – The coordinate to look up
- Returns:
The index of the pixel containing the coordinate
-
void cspline_init(const std::vector<double> &px, const std::vector<double> &data, std::vector<double> &local_tridiag_sol)¶
Initializes the cubic spline coefficients.
Sets up the tridiagonal system and solves it to obtain the cubic spline coefficients.
- Parameters:
px – Vector of x coordinates
data – Vector of function values at the x coordinates
-
double cspline_eval_deriv(std::vector<double> &px, std::vector<double> &data, std::vector<double> &local_tridiag_sol, double value, int length)¶
Evaluates the derivative of a cubic spline at a specified point.
Computes the first derivative of the cubic spline function at the given value.
- Parameters:
px – Vector of x coordinates
data – Vector of function values at the x coordinates
value – The point at which to evaluate the derivative
length – The length of the px and data arrays
- Returns:
The derivative value at the specified point
-
Hermite(double *img, int px_hori, int px_vert)¶