Vista     Main Page   Class List   Function List   File List   Examples  


CMotion2DImage< Type > Class Template Reference

The CMotion2DImage class provides basic image manipulations. More...

#include <CMotion2DImage.h>

List of all members.

Public Methods

 CMotion2DImage ()
 CMotion2DImage (const CMotion2DImage< Type > &)
 CMotion2DImage (unsigned nb_rows, unsigned nb_cols)
 CMotion2DImage (unsigned nb_rows, unsigned nb_cols, Type value)
 ~CMotion2DImage ()
bool Init (unsigned nb_rows, unsigned nb_cols)
bool Init (unsigned nb_rows, unsigned nb_cols, Type value)
bool Resize (unsigned nb_rows, unsigned nb_cols)
void Subsample ()
bool And (CMotion2DImage< Type > &A, CMotion2DImage< Type > &B)
bool And (CMotion2DImage< Type > &A, CMotion2DImage< Type > &B, Type label)
bool MedianFilter (unsigned filterRowSize, unsigned filterColSize)
unsigned GetRows () const
unsigned GetCols () const
unsigned GetNumberOfPixel () const
Type * operator[] (unsigned i)
const Type * operator[] (unsigned i) const
void operator= (Type x)
void operator= (const CMotion2DImage< Type > &image)
CMotion2DImage< Type > operator- (const CMotion2DImage< Type > &image)

Public Attributes

Type * bitmap
Type ** row


Detailed Description

template<class Type>
class CMotion2DImage< Type >

The CMotion2DImage class provides basic image manipulations.

Data structure

Each image is build using two structures (an array bitmap which size is [nb_cols*nb_rows]) and an array of pointer rows (which size is [nb_rows]) the ith element in the row array. row[i] is a pointer toward the ith "line" of the image (i.e., bitmap +i*nb_cols )

image-data-structure.gif

Such a structure allows a fast access to each element of the image. If i is the ith rows and j the jth column, the value of this pixel is given by I[i][j] (that is equivalent to row[i][j]).

This is a template class, therefore the type of each element of the array is not a priori defined.

The CMotion2DImage class is only provided for convenience in order to build the Motion2D example programs. Therefore, image input/output manipulations are restricted and only supported for PNG (see ReadPNG() and WritePNG() functions), RAW and PNM file format.

A RAW image file contains simply the list of pixel values with no header. That is why the number of columns and of rows must be given by the user. For RAW file format images, two sets of functions exist, one for the traditional 8-bits images named RAW8 (see functions ReadRAW8() and WriteRAW8()), the other for 9 to 16 bits images named RAW16 (see functions ReadRAW16() and WriteRAW16()).

The different PNM formats are PGM P5 (see functions ReadPGM() and WritePGM()) and PPM P6 (see functions ReadPPM() or WritePPM()). To know more about this image file format: man png, man pgm or man ppm.

Examples:

Motion2D.cpp, and Warping.cpp.


Constructor & Destructor Documentation

template<class Type>
CMotion2DImage< Type >::CMotion2DImage  
 

Default constructor. No memory allocation is done.

See also:
CMotion2DImage(unsigned, unsigned), CMotion2DImage(unsigned, unsigned, Type),

template<class Type>
CMotion2DImage< Type >::CMotion2DImage const CMotion2DImage< Type > &    I
 

Copy constructor.

template<class Type>
CMotion2DImage< Type >::CMotion2DImage unsigned    nb_rows,
unsigned    nb_cols
 

Constructor.

Allocates memory for an image of nb_rows rows and nb_cols columns and set all the elements of the bitmap to 0.

If the image was already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

See also:
CMotion2DImage(), Init(unsigned, unsigned)

template<class Type>
CMotion2DImage< Type >::CMotion2DImage unsigned    nb_rows,
unsigned    nb_cols,
Type    value
 

Constructor.

Allocates memory for an image of nb_rows rows and nb_cols columns and set all the elements of the bitmap to value.

If the image was already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

See also:
CMotion2DImage(), Init(unsigned, unsigned)

template<class Type>
CMotion2DImage< Type >::~CMotion2DImage  
 

Destroys the image. Free the memory used by the image.


Member Function Documentation

template<class Type>
bool CMotion2DImage< Type >::And CMotion2DImage< Type > &    A,
CMotion2DImage< Type > &    B,
Type    label
 

Computes a "specific" AND between the A et B images.

Returns:
true if successful, or false if image size differs or if memory cannot be allocated.

template<class Type>
bool CMotion2DImage< Type >::And CMotion2DImage< Type > &    A,
CMotion2DImage< Type > &    B
 

Computes the logical AND between the A et B images.

C = A & B

Returns:
true if successful, or false if image size differs or if memory cannot be allocated.

template<class Type>
unsigned CMotion2DImage< Type >::GetCols   const [inline]
 

Returns the number of columns of an image.

See also:
GetRows()
Examples:
Motion2D.cpp, and Warping.cpp.

template<class Type>
unsigned CMotion2DImage< Type >::GetNumberOfPixel   const [inline]
 

Returns the number of pixels in the image. This number reflects the image size.

template<class Type>
unsigned CMotion2DImage< Type >::GetRows   const [inline]
 

Returns the number of rows of an image.

See also:
GetCols()
Examples:
Motion2D.cpp, and Warping.cpp.

template<class Type>
bool CMotion2DImage< Type >::Init unsigned    nb_rows,
unsigned    nb_cols,
Type    value
 

Allocates memory for an image of nb_rows rows and nb_cols columns and set all elements of the bitmap to value.

Returns:
true if successful, or false if memory cannot be allocated.
See also:
Init(unsigned, unsigned)

template<class Type>
bool CMotion2DImage< Type >::Init unsigned    nb_rows,
unsigned    nb_cols
 

Allocates memory for an image of nb_rows rows and nb_cols columns. Elements of the bitmap are not initialized.

If the image was already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Returns:
true if successful, or false if memory cannot be allocated.
See also:
Init(unsigned, unsigned, Type)
Examples:
Motion2D.cpp, and Warping.cpp.

template<class Type>
bool CMotion2DImage< Type >::MedianFilter unsigned    filterRowSize,
unsigned    filterColSize
 

Apply a median filter to the image. The filter size is given by the filterRowSize and filterColSize parameters.

Returns:
false if the filter size is bad (ie. filterRowSize or filterColSize are equal to zero), true if the filtering was successfully achieved.
Examples:
Motion2D.cpp.

template<class Type>
CMotion2DImage< Type > CMotion2DImage< Type >::operator- const CMotion2DImage< Type > &    image
 

Makes a difference between 2 images returns a reference to the difference image.

template<class Type>
void CMotion2DImage< Type >::operator= const CMotion2DImage< Type > &    image
 

Assigns a copy of image to this image and returns a reference to this image.

template<class Type>
void CMotion2DImage< Type >::operator= Type    x
 

Set each element of the bitmap to x.

template<class Type>
const Type* CMotion2DImage< Type >::operator[] unsigned    i const [inline]
 

Allows a direct access to the bitmap to get the value of the pixel located at the ith line and jth column: [i][j] = (row[i])[j].

template<class Type>
Type* CMotion2DImage< Type >::operator[] unsigned    i [inline]
 

Allows a direct access to the bitmap to change the value of the pixel located at the ith line and jth column: [i][j] = (row[i])[j].

template<class Type>
bool CMotion2DImage< Type >::Resize unsigned    nb_rows,
unsigned    nb_cols
 

Allocates memory for an image of nb_rows rows and nb_cols columns. Elements of the bitmap are not initialized.

If the image was already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Returns:
true if successful, or false if memory cannot be allocated.
See also:
Init(unsigned, unsigned)

template<class Type>
void CMotion2DImage< Type >::Subsample  
 

Subsample the image. The subsampled image is given in I. The number of rows and columns of this image is divided by two. To determine the pixel value, we consider the mean value of the four neighbours.


Member Data Documentation

template<class Type>
Type* CMotion2DImage< Type >::bitmap
 

The bitmap array associated to the image.

Examples:
Motion2D.cpp, and Warping.cpp.

template<class Type>
Type** CMotion2DImage< Type >::row
 

The row array to access to the first element of a line.


The documentation for this class was generated from the following files:
Motion2D is Copyright © 1995-2005 by Inria
This documentation was generated on 31 Jan 2005 by Fabien Spindler for Motion2D 1.3.11 using doxygen1.2.18 written by Dimitri van Heesch, © 1997-2005