Functions

Math Utilities
[Utilities]

Collaboration diagram for Math Utilities:

Functions

int imRound (float x)
int imResampleInt (int x, double factor)
template<class T , class TU >
imZeroOrderDecimation (int width, int height, T *map, double xl, double yl, double box_width, double box_height, TU Dummy)
template<class T , class TU >
imBilinearDecimation (int width, int height, T *map, double xl, double yl, double box_width, double box_height, TU Dummy)
template<class T >
imZeroOrderInterpolation (int width, int height, T *map, double xl, double yl)
template<class T >
imBilinearInterpolation (int width, int height, T *map, double xl, double yl)
template<class T , class TU >
imBicubicInterpolation (int width, int height, T *map, double xl, double yl, TU Dummy)
template<class T >
void imMinMax (const T *map, int count, T &min, T &max, int absolute=0)
template<class T >
void imMinMaxType (const T *map, int count, T &min, T &max, int absolute=0)

Detailed Description

When converting between continuous and discrete use:
Continuous = Discrete + 0.5 [Reconstruction/Interpolation]
Discrete = Round(Continuous - 0.5) [Sampling/Quantization]
Notice that must check min-max limits when converting from Continuous to Discrete.
When converting between discrete and discrete use:
integer src_size, dst_len, src_i, dst_i
real factor = (real)(dst_size)/(real)(src_size)
dst_i = Round(factor*(src_i + 0.5) - 0.5)
See im_math.h

Function Documentation

int imRound ( float  x  )  [inline]

Round a real to the nearest integer.

Referenced by imColorQuantize(), and imZeroOrderInterpolation().

int imResampleInt ( int  x,
double  factor 
) [inline]

Converts between two discrete grids. factor is "dst_size/src_size".

template<class T , class TU >
T imZeroOrderDecimation ( int  width,
int  height,
T *  map,
double  xl,
double  yl,
double  box_width,
double  box_height,
TU  Dummy 
) [inline]

Does Zero Order Decimation (Mean).

template<class T , class TU >
T imBilinearDecimation ( int  width,
int  height,
T *  map,
double  xl,
double  yl,
double  box_width,
double  box_height,
TU  Dummy 
) [inline]

Does Bilinear Decimation.

template<class T >
T imZeroOrderInterpolation ( int  width,
int  height,
T *  map,
double  xl,
double  yl 
) [inline]

Does Zero Order Interpolation (Nearest Neighborhood).

References imRound().

template<class T >
T imBilinearInterpolation ( int  width,
int  height,
T *  map,
double  xl,
double  yl 
) [inline]

Does Bilinear Interpolation.

template<class T , class TU >
T imBicubicInterpolation ( int  width,
int  height,
T *  map,
double  xl,
double  yl,
TU  Dummy 
) [inline]

Does Bicubic Interpolation.

template<class T >
void imMinMax ( const T *  map,
int  count,
T &  min,
T &  max,
int  absolute = 0 
) [inline]

Calculates minimum and maximum values.

Referenced by imMinMaxType().

template<class T >
void imMinMaxType ( const T *  map,
int  count,
T &  min,
T &  max,
int  absolute = 0 
) [inline]

Calculates minimum and maximum values with additional considerations for data type conversion and normalized operations.

References imMinMax().