Image operations, image I/O

All the tools for image I/O and computations. It uses the CImg Library for some functions. More...

Classes

class  Color
 IDIL color class. More...

Reorder elements

template<typename T>
Array< T > & transpose (Array< T > &im)
 Transpose a matrix or an image.

Colors

Colorgray (char g)
 Returns a gray color.
Colorcolor (char r, char g, char b)
 Returns the color (r,g,b).
#define black   color(0,0,0)
 Returns a black color.
#define white   color(255,255,255)
 Returns a white color.
#define blue   color(0,0,255)
 Returns a blue color.
#define green   color(0,255,0)
 Returns a green color.
#define red   color(255,0,0)
 Returns a red color.
#define yellow   color(255,255,0)
 Returns yellow color.
#define orange   color(255,128,64)
 Returns orange color.
#define pink   color(255,0,255)
 Returns pink color.
#define purple   color(192,0,128)
 Returns purple color.
#define brown   color(128,96,0)
 Returns brown color.

Accessing Image info

template<typename T>
long XSize (Array< T > &im)
 Return the horizontal dimension of the image.

Image I/O

template<typename T>
*Array< T > & loadImage (Array< T > &im, string str)
 Load an image and returns it.
*Array< unsigned char > & loadImage (string str)
 Load an (unsigned char) image from a file.
template<typename T>
*void saveImage (string str, Array< T > &im)
 Save an image.
template<typename T, typename T2>
*void saveDrishtiRAW (string str, Array< T2 > &im)
 Save an 3D volume unsing the Drishti file format.
template<typename T>
*Array< T > & readDrishtiRAW (string str)
 Read a 3D volume unsing the Drishti file format.
template<class T>
char getDrishtiType ()
template<>
char getDrishtiType< unsigned char > ()
template<>
char getDrishtiType< unsigned short > ()
template<>
char getDrishtiType< unsigned int > ()
template<>
char getDrishtiType< float > ()
void saveDrishtiPolyline (string str, Array< int > &gridsize, Array< float > &x, Array< float > &y, Array< float > &z, Array< float > &r)

Extraction

template<typename T>
Array< T > & extractLine (Array< T > &im, int x1, int y1, int x2, int y2)
 Extract a linear segment from a 2D picture.
template<typename T>
Array< T > & channel (Array< T > &im, int ch)
 Extract a color channel from a picture.
template<typename T>
Array< T > & color (Array< T > &im)
 Make a color from a grey level image.
template<typename T>
Array< T > & color (Array< T > &im, Array< Color > &map, bool saturate=true)
 Make a color from a grey level image and a color map.
template<typename T>
Array< T > & color (Array< T > &imr, Array< T > &img, Array< T > &imb)
 Make a color from 3 grey level images, one par channel.
template<class T>
Array< double > & dist (Array< T > &t)
 Returns an array containing the distance to the closest corner (2D only).
template<typename T>
Array< T > & crop (Array< T > &im, long xmin, long xmax, long ymin, long ymax, long zmin=0, long zmax=0)
 Crop a 2D/3D image.
template<typename T>
Array< T > & resize (Array< T > &im, int sx, int sy, int sz=-100, int interp=1)
 Resize the image with a Deriche filter (quasi-gaussian filter, from CImg).

Image Operations

template<class T>
Array< T > & normalise (Array< T > &t, T tmax=255)
 Normalise an Array.
template<class T, class T2>
Array< T > & threshold (Array< T > &t, T2 th, T2 ton=1, T2 toff=0)
 Threshold an Array.
template<typename T>
Array< T > & rotate (Array< T > &im, float angle, int cond=2)
 Rotate in the 2D plane the image with a Deriche filter (quasi-gaussian filter, calling CImg).
template<typename T>
Array< T > & blur (Array< T > &im, float sigma)
 Blur the image with a Deriche filter (quasi-gaussian filter, CImg).
template<typename T>
Array< T > & deriche (Array< T > &im, float sigma, const int order=0, const char axe= 'x', const unsigned int cond=1)
 Apply the deriche filter the image with a Deriche filter (from CImg).
template<typename T>
Array< T > & erode (Array< T > &im, int n=1)
 Erode the image (CImg).
template<typename T>
Array< T > & dilate (Array< T > &im, int n=1)
 Dilate the image.
template<typename T>
Array< T > & thin (Array< T > &im)
 Thin the image (works only in 2D).
template<typename T>
Array< T > & skeletonize (Array< T > &im)
 Skeletonize the image (2D).
template<typename T>
Array< int > & label (Array< T > &im, bool includediag=false)
 Label the domains of a binarized image (2D & 3D).
template<typename T>
Array< int > & voronoi (Array< T > &im)
 Computes the Voronoi tesselation of an image (2D & 3D).
template<typename T>
Array< T > & distanceMap (Array< T > &im, int mode=0)
 Computes the distance map of an image (2D & 3D).
template<typename T>
Array< complex< double > > & simple_fft (Array< complex< T > > &ct, const bool inverse=false)
 FFT for images.
template<typename T>
Array< complex< double > > & simple_fft (Array< T > &t, const bool inverse=false)
 FFT for images.
template<typename T>
Array< T > & radon (Array< T > &t, long theta_res=180, long rho_res=200)
 Compute the radon transform of the image (2D Mono only).
template<typename T>
Array< T > & gradon (Array< T > &t, long theta_res=180, long rho_res=200)
 Computes the histogram of the gradient orientations (2D mono).

Image Drawing

template<typename T>
void fill (Array< T > &im, const Color &clr)
template<class T>
void drawLine (Array< T > &im, long x1, long y1, long x2, long y2, Color &c, unsigned int pattern=-1, float opacity=1)
 Draw a line on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.
template<class T>
void drawRectangle (Array< T > &im, long x1, long y1, long x2, long y2, Color &c, float opacity=1)
 Draw a rectangle on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.
template<class T>
void drawBox (Array< T > &im, long x1, long y1, long x2, long y2, Color &c, unsigned int pattern=-1, float opacity=1)
 Draw a box on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.
template<class T>
void drawTriangle (Array< T > &im, long x0, long y0, long x1, long y1, long x2, long y2, Color &c, unsigned int pattern=-1, float opacity=1)
 Draw a box on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.
template<class T>
void drawCircle (Array< T > &im, long x0, long y0, float r, Color &c, unsigned int pattern=-1, float opacity=1)
 Draw a circle on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.
template<class T, class T2>
void drawImage (Array< T > &im, long x, long y, Array< T2 > &sprite)
 Draw a 2D sprite on a 2D image, at the coordinates (x,y).
template<class T>
void drawPoint (Array< T > &im, long x, long y, T r=0, T g=0, T b=0)
 Draw a point on a picture, at the coordinates (x,y), with color (r,g,b).
template<class T>
void drawPoint (Array< T > &im, long x, long y, Color c)
 Draw a point on a picture, at the coordinates (x,y), with color c.
template<class T>
void drawPoint (Array< T > &im, long x, long y, long z, Color c)
 Draw a point on a picture, at the coordinates (x,y), with color c.
template<class T>
CImg< T > & getCImgReference (Array< T > &im)
template<class T>
void releaseCImgReference (CImg< T > &cimgref)

Detailed Description

All the tools for image I/O and computations. It uses the CImg Library for some functions.

IDIL contains many routines for Image manipulation, from IO operations to image analysis tools. IDIL makes use when possible of the CImg library, and uses a similar way to represent images in the memory.

An image is basically an Array of any type T with the following convention for its dimension:

Array<T> [X_Size, Y_Size, Z_Size, Pixel_colors, Time]

The Image has 5 dimensions allowing for both Z-Stacks and time dependance. If the Z dimension is used, 3D algorithms will be applied when available. Algorithms are also applied sequentially for each color and time, unless specified otherwise.


Function Documentation

template<typename T>
Array<T>& blur ( Array< T > &  im,
float  sigma 
) [inline]

Blur the image with a Deriche filter (quasi-gaussian filter, CImg).

Parameters:
im : image Array,
sigma : width.
Returns the blured image.

template<typename T>
Array<T>& channel ( Array< T > &  im,
int  ch 
) [inline]

Extract a color channel from a picture.

Parameters:
im : image,
ch : channel (0: red, 1: blue, 2:green).

template<typename T>
Array<T>& color ( Array< T > &  imr,
Array< T > &  img,
Array< T > &  imb 
) [inline]

Make a color from 3 grey level images, one par channel.

Parameters:
imr : red channel image.
img : green channel image.
imb : blue channel image.

template<typename T>
Array<T>& color ( Array< T > &  im,
Array< Color > &  map,
bool  saturate = true 
) [inline]

Make a color from a grey level image and a color map.

Parameters:
im : image,
im : color map, as an array of colors.

template<typename T>
Array<T>& color ( Array< T > &  im  )  [inline]

Make a color from a grey level image.

Parameters:
im : image.

template<typename T>
Array<T>& crop ( Array< T > &  im,
long  xmin,
long  xmax,
long  ymin,
long  ymax,
long  zmin = 0,
long  zmax = 0 
) [inline]

Crop a 2D/3D image.

Parameters:
im : image Array,
xmin,xmax,ymin,ymax,zmin,zmax. Returns the croped image.
Loop over z and time is so far missing.

throw !!!

template<typename T>
Array<T>& deriche ( Array< T > &  im,
float  sigma,
const int  order = 0,
const char  axe = 'x',
const unsigned int  cond = 1 
) [inline]

Apply the deriche filter the image with a Deriche filter (from CImg).

Returns the filtered image.

template<typename T>
Array<T>& dilate ( Array< T > &  im,
int  n = 1 
) [inline]

Dilate the image.

Parameters:
im : image Array,
n : number of dilatations.
Returns the dilated image.

template<typename T>
Array<T>& distanceMap ( Array< T > &  im,
int  mode = 0 
) [inline]

Computes the distance map of an image (2D & 3D).

Parameters:
im : image Array,
mode : distance measurement: 0 = Manhatan, 1 = Chessboard The input image is first thresholded to force values to be 0 or 1. Boundaries are assumed to be 0 in the current version.

template<class T>
void drawBox ( Array< T > &  im,
long  x1,
long  y1,
long  x2,
long  y2,
Color c,
unsigned int  pattern = -1,
float  opacity = 1 
) [inline]

Draw a box on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.

Parameters:
im : image Array,
x1,y1 : starting point,
x2,y2 : end point,
c : color used for the line.
pattern : see CImg.
opacity : opacite [0-1].

template<class T>
void drawCircle ( Array< T > &  im,
long  x0,
long  y0,
float  r,
Color c,
unsigned int  pattern = -1,
float  opacity = 1 
) [inline]

Draw a circle on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.

Parameters:
im : image Array,
x1,y1 : coordinates of the circle center
r : radius of the circle
c : color used for the line.
pattern : see CImg.
opacity : opacite [0-1].

template<class T, class T2>
void drawImage ( Array< T > &  im,
long  x,
long  y,
Array< T2 > &  sprite 
) [inline]

Draw a 2D sprite on a 2D image, at the coordinates (x,y).

Parameters:
im : image Array,
x,y : top-left corner coordinates,
sprite : image to insert.

template<class T>
void drawLine ( Array< T > &  im,
long  x1,
long  y1,
long  x2,
long  y2,
Color c,
unsigned int  pattern = -1,
float  opacity = 1 
) [inline]

Draw a line on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.

Parameters:
im : image Array,
x1,y1 : starting point,
x2,y2 : end point,
c : color used for the line.
pattern : see CImg.
opacity : opacite [0-1].

template<class T>
void drawRectangle ( Array< T > &  im,
long  x1,
long  y1,
long  x2,
long  y2,
Color c,
float  opacity = 1 
) [inline]

Draw a rectangle on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.

Parameters:
im : image Array,
x1,y1 : starting point,
x2,y2 : end point,
c : color used for the line.
opacity : opacite [0-1].

template<class T>
void drawTriangle ( Array< T > &  im,
long  x0,
long  y0,
long  x1,
long  y1,
long  x2,
long  y2,
Color c,
unsigned int  pattern = -1,
float  opacity = 1 
) [inline]

Draw a box on a picture, from the coordinates (x1,y1) to (x2,y2), with color c.

Parameters:
im : image Array,
x1,y1 : starting point,
x2,y2 : end point,
c : color used for the line.
pattern : see CImg.
opacity : opacite [0-1].

template<typename T>
Array<T>& erode ( Array< T > &  im,
int  n = 1 
) [inline]

Erode the image (CImg).

Parameters:
im : image Array,
n : number of erosions.
Returns the eroded image.

template<typename T>
Array<T>& extractLine ( Array< T > &  im,
int  x1,
int  y1,
int  x2,
int  y2 
) [inline]

Extract a linear segment from a 2D picture.

Parameters:
im : image,
x1,y1 : start point,
x2,y2 : end point.

template<typename T>
void fill ( Array< T > &  im,
const Color clr 
) [inline]

template<typename T>
Array<T>& gradon ( Array< T > &  t,
long  theta_res = 180,
long  rho_res = 200 
) [inline]

Computes the histogram of the gradient orientations (2D mono).

Parameters:
t : image Array,
theta_res : resolution of the angular axis,
rho_res : resolution in the radial direction
The histogram is ploted on the Radon space. Resolutions correspond the dimension of the result image.

template<typename T>
Array<int>& label ( Array< T > &  im,
bool  includediag = false 
) [inline]

Label the domains of a binarized image (2D & 3D).

Parameters:
im : image Array,
Returns the labelled image. The values of each domain are successive intergers, from 1 to the number of domains.

* Array<unsigned char>& loadImage ( string  str  ) 

Load an (unsigned char) image from a file.

Parameters:
str : filename.

template<typename T>
* Array<T>& loadImage ( Array< T > &  im,
string  str 
) [inline]

Load an image and returns it.

Parameters:
im : destination Array,
str : filename.

template<class T>
Array<T>& normalise ( Array< T > &  t,
tmax = 255 
) [inline]

Normalise an Array.

Parameters:
t : data Array,
max value

template<typename T>
Array<T>& radon ( Array< T > &  t,
long  theta_res = 180,
long  rho_res = 200 
) [inline]

Compute the radon transform of the image (2D Mono only).

Parameters:
t : image Array,
theta_res : resolution of the angular axis,
rho_res : resolution in the radial direction
Resolutions correspond the dimension of the result image.

template<typename T>
* Array<T>& readDrishtiRAW ( string  str  )  [inline]

Read a 3D volume unsing the Drishti file format.

Parameters:
im : image Array,
str : filename.

template<typename T>
Array<T>& resize ( Array< T > &  im,
int  sx,
int  sy,
int  sz = -100,
int  interp = 1 
) [inline]

Resize the image with a Deriche filter (quasi-gaussian filter, from CImg).

Parameters:
im : image Array,
sx,sy : new size, pourcent if negative.
interp : interpolation mode
# 0 = no interpolation : additionnal space is filled with 0. # 1 = bloc interpolation (nearest point). # 2 = mosaic : image is repeated if necessary. # 3 = linear interpolation. # 4 = grid interpolation. # 5 = bi-cubic interpolation.

Returns the resized image.

template<typename T>
Array<T>& rotate ( Array< T > &  im,
float  angle,
int  cond = 2 
) [inline]

Rotate in the 2D plane the image with a Deriche filter (quasi-gaussian filter, calling CImg).

Parameters:
im : image Array,
angle : angle.
Returns the rotated image.

template<typename T, typename T2>
* void saveDrishtiRAW ( string  str,
Array< T2 > &  im 
) [inline]

Save an 3D volume unsing the Drishti file format.

Parameters:
im : image Array,
str : filename.

template<typename T>
* void saveImage ( string  str,
Array< T > &  im 
) [inline]

Save an image.

Parameters:
im : image Array,
str : filename.

template<typename T>
Array<complex<double> >& simple_fft ( Array< T > &  t,
const bool  inverse = false 
) [inline]

FFT for images.

Parameters:
t : image Array with a real valued type,
inverse : false for direct, true for inverse.
Returns the Fourrier transform of the image. The image size has to be a power of 2. It uses the algorithm of the CImg library.

template<typename T>
Array<complex<double> >& simple_fft ( Array< complex< T > > &  ct,
const bool  inverse = false 
) [inline]

FFT for images.

Parameters:
cplxt : image Array with a complex type,
inverse : false for direct, true for inverse.
Returns the Fourrier transform of the image. The image size has to be a power of 2. It uses the algorithm of the CImg library.

template<typename T>
Array<T>& skeletonize ( Array< T > &  im  )  [inline]

Skeletonize the image (2D).

Parameters:
im : image Array,
Returns the skeletonized image.

template<typename T>
Array<T>& thin ( Array< T > &  im  )  [inline]

Thin the image (works only in 2D).

Parameters:
im : image Array,
Returns the thined image.

template<class T, class T2>
Array<T>& threshold ( Array< T > &  t,
T2  th,
T2  ton = 1,
T2  toff = 0 
) [inline]

Threshold an Array.

Parameters:
t : data Array,
th : value of the threshold.
ton value if below the threshold
toff value if above the threshold

template<typename T>
Array<T>& transpose ( Array< T > &  im  )  [inline]

Transpose a matrix or an image.

Parameters:
im : image Array, Returns the transposed image.

template<typename T>
Array<int>& voronoi ( Array< T > &  im  )  [inline]

Computes the Voronoi tesselation of an image (2D & 3D).

Parameters:
im : image Array,
Returns a labelled image. The input image should be zero everywhere, except 1 on the cell centers. The values of each domain are successive intergers, from 1 to the number of domains.


Generated on Fri Oct 24 18:41:59 2008 for IDIL by  doxygen 1.5.5