tpimageutil.h File Reference

#include <typeinfo>
#include <cstring>
#include <cmath>
#include <cassert>
#include "tpimage.h"
Include dependency graph for tpimageutil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef double(* DoubleFunc1 )(double)
typedef double(* DoubleFunc2 )(double, double)

Functions

template<int dw>
void GaussLowPass (SImage< float > &limg, SImage< float > &oimg, float variance)
 Gaussian low-pass filtering, with computational cost proportional to dw.
template<class T >
void DericheLowPass (SImage< T > &src, SImage< T > &dst, double sigma, bool zeroboard)
 Low-pass filtering using Deriche's recursive method, with constant cost for all filter sizes. Suitable for $ \sigma $ up to about 5. For floating point images, an assembly implementation is used.
template<class S , class T >
void RGBToGrey (SImage< S > &src, SImage< T > &dst)
 Convert from RGB (three value per pixel) to grey-level image.
template<class S , class T >
void YUVToGrey (SImage< S > &src, SImage< T > &dst)
 Convert from UYVY (two value per pixel) to grey-level image.
template<class S , class T >
void RGBToYUV (SImage< S > &src, SImage< T > &yimg, SImage< T > &uimg, SImage< T > &vimg)
 Convert from RGB to YUV.
template<class S , class T >
void YUVToRGB (SImage< T > &yimg, SImage< T > &uimg, SImage< T > &vimg, SImage< S > &dst)
 Convert from YUV to RGB.
template<class T >
void operator*= (SImage< T > &dst, SImage< T > &src)
 Point-wise multiply two images.
template<class T >
void operator/= (SImage< T > &dst, SImage< T > &src)
 Point-wise divide two images.
template<class T >
void operator+= (SImage< T > &dst, SImage< T > &src)
 Point-wise add two images.
template<class T >
void operator-= (SImage< T > &dst, SImage< T > &src)
 Point-wise subtract two images.
template<class T >
void Laplace (SImage< T > &src, SImage< T > &dst)
 Compute Laplacian of image.
template<class T >
void AbsDiff (SImage< T > &src, SImage< T > &dst)
 Compute absolute difference between two images.
template<class T >
void Abs (SImage< T > &src, SImage< T > &dst)
 Compute absolute value of image.
template<class T >
void RotatingSum (SImage< T > &src, SImage< T > &dst, int dw, int dh)
 Sum up values within rectangular regions (quick implementation).
template<class T >
void ReScale (SImage< T > &img, float scale)
 Rescale image values.
template<class T , class S >
void Copy (T *indat, SImage< S > &img)
 Copy an data array to image.
template<class T , class S >
void Copy (SImage< T > &src, SImage< S > &dst)
 Copy data from one image to another.
template<class T >
void SubCopy (SImage< T > &src, SImage< T > &dst, int x, int y)
 Copy a sub-window from an image.
template<class T >
void Clear (SImage< T > &img)
 Clear image data.
template<class T >
void Fill (SImage< T > &img, T value)
 Fill image data with a certain value.
template<class T >
void ScaleUp (SImage< T > &src, SImage< T > &dst)
 Scale-up an image to twice the size.
template<class T >
void ScaleDown (SImage< T > &src, SImage< T > &dst)
 Low-pass and scale-down an image to half the size.
template<int res, class T >
void SubSample (SImage< T > &src, SImage< T > &dst)
 Scale-down an image to a smaller size.
template<class T >
void LowPass (SImage< T > &img, SImage< T > &out)
 Low-pass an image with variance $\sigma^2$ = 1.0.
template<class T >
void LowPassZero (SImage< T > &img, SImage< T > &out)
 Low-pass an image with variance $\sigma^2$ = 1.0.
template<class T >
void LowPass3 (SImage< T > &img, SImage< T > &out)
 Low-pass an image with variance $\sigma^2$ = 0.5.
template<class T >
void LowPassX (SImage< T > &img, SImage< T > &out)
 Low-pass an image x-wise with variance $\sigma^2$ = 1.0.
template<class T >
void LowPassY (SImage< T > &img, SImage< T > &out)
 Low-pass an image y-wise with variance $\sigma^2$ = 1.0.
template<class T >
void LowPassX3 (SImage< T > &img, SImage< T > &out)
 Low-pass an image x-wise with variance $\sigma^2$ = 0.5.
template<class T >
void LowPassY3 (SImage< T > &img, SImage< T > &out)
 Low-pass an image y-wise with variance $\sigma^2$ = 0.5.
template<class T >
void HighPassX3 (SImage< T > &img, SImage< T > &out)
 Compute x-wise derivative.
template<class T >
void HighPassY3 (SImage< T > &img, SImage< T > &out)
 Compute y-wise derivative.
template<class T , class S >
void SubRectify (SImage< T > &img, SImage< S > &out, float angle, float focal, float xp, float yp, bool sourcepos=true)
 Recify (rotate around y-axis and translate) a sub-window.
template<class T , class S >
void Rectify (SImage< T > &img, SImage< S > &out, float angle, float focal, float xshift=0.0, float yshift=0.0)
 Recify (rotate around y-axis and translate) an image.
template<class T >
void RadialCorrect (SImage< T > &img, SImage< T > &out, float factor)
 Correct an image for radial distortion.
template<class T >
void SImageFunc (DoubleFunc1, SImage< T > &img, SImage< T > &out)
template<class T >
void SImageFunc (DoubleFunc2, SImage< T > &img1, SImage< T > &img2, SImage< T > &out)

Detailed Description

Templated image utility functions

Definition in file tpimageutil.h.


Function Documentation

template<class T >
void Abs ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Compute absolute value of image.

Parameters:
src source image
Return values:
dst absolute value image
template<class T >
void AbsDiff ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Compute absolute difference between two images.

Parameters:
src source image
Return values:
dst absolute difference image
template<class T >
void Clear ( SImage< T > &  img  )  [inline]

Clear image data.

Return values:
img image to be cleared
template<class T , class S >
void Copy ( SImage< T > &  src,
SImage< S > &  dst 
) [inline]

Copy data from one image to another.

Parameters:
src source image
Return values:
dst destination image
template<class T , class S >
void Copy ( T *  indat,
SImage< S > &  img 
) [inline]

Copy an data array to image.

Parameters:
indat array of image data
Return values:
img destination image
template<class T >
void DericheLowPass ( SImage< T > &  src,
SImage< T > &  dst,
double  sigma,
bool  zeroboard 
) [inline]

Low-pass filtering using Deriche's recursive method, with constant cost for all filter sizes. Suitable for $ \sigma $ up to about 5. For floating point images, an assembly implementation is used.

Parameters:
src source image
sigma filter standard deviation $ \sigma $
zeroboard whether to assume outer area is zero or mirrored
Return values:
dst filtered image
template<class T >
void Fill ( SImage< T > &  img,
value 
) [inline]

Fill image data with a certain value.

Parameters:
value value to be used for filling
Return values:
img image to be filled
template<int dw>
void GaussLowPass ( SImage< float > &  limg,
SImage< float > &  oimg,
float  variance 
) [inline]

Gaussian low-pass filtering, with computational cost proportional to dw.

Parameters:
dw filter width (an odd value, typ. $ 4 \sigma+1 $)
limg source image
variance filter variance $ \sigma^2 $
Return values:
oimg filtered image
template<class T >
void HighPassX3 ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Compute x-wise derivative.

Parameters:
img source image
Return values:
out x-wise derivative
template<class T >
void HighPassY3 ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Compute y-wise derivative.

Parameters:
img source image
Return values:
out y-wise derivative
template<class T >
void Laplace ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Compute Laplacian of image.

Parameters:
src source image
Return values:
dst Laplacian image
template<class T >
void LowPass ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image with variance $\sigma^2$ = 1.0.

Parameters:
img source image (repeated boundary assumed)
Return values:
out blurred destination image
template<class T >
void LowPass3 ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image with variance $\sigma^2$ = 0.5.

Parameters:
img source image (repeated boundary assumed)
Return values:
out blurred destination image
template<class T >
void LowPassX ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image x-wise with variance $\sigma^2$ = 1.0.

Parameters:
img source image
Return values:
out blurred destination image
template<class T >
void LowPassX3 ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image x-wise with variance $\sigma^2$ = 0.5.

Parameters:
img source image
Return values:
out blurred destination image
template<class T >
void LowPassY ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image y-wise with variance $\sigma^2$ = 1.0.

Parameters:
img source image
Return values:
out blurred destination image
template<class T >
void LowPassY3 ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image y-wise with variance $\sigma^2$ = 0.5.

Parameters:
img source image
Return values:
out blurred destination image
template<class T >
void LowPassZero ( SImage< T > &  img,
SImage< T > &  out 
) [inline]

Low-pass an image with variance $\sigma^2$ = 1.0.

Parameters:
img source image (zero boundary assumed)
Return values:
out blurred destination image
template<class T >
void operator*= ( SImage< T > &  dst,
SImage< T > &  src 
) [inline]

Point-wise multiply two images.

Parameters:
src source image
Return values:
dst product image
template<class T >
void operator+= ( SImage< T > &  dst,
SImage< T > &  src 
) [inline]

Point-wise add two images.

Parameters:
src source image
Return values:
dst sum image
template<class T >
void operator-= ( SImage< T > &  dst,
SImage< T > &  src 
) [inline]

Point-wise subtract two images.

Parameters:
src source image
Return values:
dst difference image
template<class T >
void operator/= ( SImage< T > &  dst,
SImage< T > &  src 
) [inline]

Point-wise divide two images.

Parameters:
src source image
Return values:
dst fraction image
template<class T >
void RadialCorrect ( SImage< T > &  img,
SImage< T > &  out,
float  factor 
) [inline]

Correct an image for radial distortion.

template<class T , class S >
void Rectify ( SImage< T > &  img,
SImage< S > &  out,
float  angle,
float  focal,
float  xshift = 0.0,
float  yshift = 0.0 
) [inline]

Recify (rotate around y-axis and translate) an image.

Parameters:
img image to be rectified
angle rotation angle around y-axis
focal focal length (in pixels)
xshift x-wise translation
yshift y-wise translation
Return values:
out rectifed image
template<class T >
void ReScale ( SImage< T > &  img,
float  scale 
) [inline]

Rescale image values.

Parameters:
scale rescaling factor
Return values:
img image to be rescales

Referenced by CUDAVisualObject::computeKeypoints().

template<class S , class T >
void RGBToGrey ( SImage< S > &  src,
SImage< T > &  dst 
) [inline]

Convert from RGB (three value per pixel) to grey-level image.

Parameters:
src RGB source image
Return values:
dst grey-level image
template<class S , class T >
void RGBToYUV ( SImage< S > &  src,
SImage< T > &  yimg,
SImage< T > &  uimg,
SImage< T > &  vimg 
) [inline]

Convert from RGB to YUV.

Parameters:
src RGB source image
Return values:
yimg luminance component image
uimg u colour component image
vimg v colour component image
template<class T >
void RotatingSum ( SImage< T > &  src,
SImage< T > &  dst,
int  dw,
int  dh 
) [inline]

Sum up values within rectangular regions (quick implementation).

Parameters:
src source image
dw region widths
dh region heights
Return values:
dst image of summed up values
template<class T >
void ScaleDown ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Low-pass and scale-down an image to half the size.

Parameters:
src source image
Return values:
dst destination image of half the size
template<class T >
void ScaleUp ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Scale-up an image to twice the size.

Parameters:
src source image
Return values:
dst destination image of twice the size
template<class T >
void SubCopy ( SImage< T > &  src,
SImage< T > &  dst,
int  x,
int  y 
) [inline]

Copy a sub-window from an image.

Parameters:
src source image
x center x-position of window in source image
y center y-position of window in source image
dst destination sub-window
template<class T , class S >
void SubRectify ( SImage< T > &  img,
SImage< S > &  out,
float  angle,
float  focal,
float  xp,
float  yp,
bool  sourcepos = true 
) [inline]

Recify (rotate around y-axis and translate) a sub-window.

Parameters:
img image to be rectified
angle rotation angle around y-axis
focal focal length (in pixels)
xp x-position of sub-window
yp y-position of sub-window
sourcepos whether positions defined in source image
Return values:
out rectifed sub-window
template<int res, class T >
void SubSample ( SImage< T > &  src,
SImage< T > &  dst 
) [inline]

Scale-down an image to a smaller size.

Parameters:
src source image
res scale-down factor
Return values:
dst scale-downed destination image
template<class S , class T >
void YUVToGrey ( SImage< S > &  src,
SImage< T > &  dst 
) [inline]

Convert from UYVY (two value per pixel) to grey-level image.

Parameters:
src UYVY source image
Return values:
dst grey-level image
template<class S , class T >
void YUVToRGB ( SImage< T > &  yimg,
SImage< T > &  uimg,
SImage< T > &  vimg,
SImage< S > &  dst 
) [inline]

Convert from YUV to RGB.

Parameters:
yimg luminance component image
uimg u colour component image
vimg v colour component image
Return values:
dst RGB image
Generated on Sun May 8 08:42:40 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3