Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages   Examples  

Image Class Template Reference

#include <Image.h>

Inheritance diagram for Image::

ByteImage FloatImage IntImage Kernel ByteKernel FloatKernel IntKernel List of all members.

Public Methods

 Image (char *name="")
 Image (int w, int h, char *name="")
 Image (const Image< T > &)
virtual ~Image ()
int getWidth () const
int getHeight () const
int getSize ()
char* getName ()
void setName (const char *name)
void makeImage (int w, int h)
void destroyImage ()
T* getPixels ()
void setPixels (int w, int h, T *data)
min ()
max ()
float avg ()
float dev ()
T* operator[] (int i)
T& operator() (int i)
Image< T >& operator= (const Image< T > &img)
int operator== (const Image< T > &img)
int operator!= (const Image< T > &img)
Image< T >& operator= (const T val)
void clearImage (const T val)
Image< T >& operator+= (const T val)
Image< T >& operator-= (const T val)
Image< T >& operator *= (const T val)
Image< T >& operator+= (const Image< T > &img)
Image< T >& operator-= (const Image< T > &img)
Image< T >& operator *= (const Image< T > &img)
void pad (int w, int h, PADDING_TYPE p)
void crop (int x1, int y1, int x2, int y2)
void makeEvenSized (void)
void closeWindow ()
void readImage (char *name)
void writeImage ()
void writeImage (char *name)
int showImage ()

Protected Attributes

int width
int height
T** pixels
char img_name [256]

Detailed Description

template<class T> class Image

Implements data structures and functions for manipulating all types of gray level images.
Examples:

test_contrast.cpp, test_conversion.cpp, test_downsampl.cpp, test_hist.cpp, test_image.cpp, test_localop.cpp, test_noise.cpp, test_reflect.cpp, test_rotate.cpp, test_thresh.cpp, test_translate.cpp, test_upsampl.cpp, and test_zoom.cpp.

Definition at line 18 of file Image.h.


Constructor & Destructor Documentation

template<class T>
Image< T >::Image<T> ( char * name = "" )
 

Creates an image with the specified name without allocating space for the image data.

Definition at line 18 of file Image.cpp.

template<class T>
Image< T >::Image<T> ( int w,
int h,
char * name = "" )
 

Creates an image of size with the specified name and allocates space for storing the image data.

Definition at line 26 of file Image.cpp.

template<class T>
Image< T >::Image<T> ( const Image< T > & img )
 

Copy constructor.

Definition at line 45 of file Image.cpp.

template<class T>
Image< T >::~Image<T> ( ) [virtual]
 

Destructor.

Definition at line 66 of file Image.cpp.


Member Function Documentation

template<class T>
void Image< T >::destroyImage<T> ( )
 

Frees the memory allocated to store the image data.

Definition at line 56 of file Image.cpp.

Referenced by makeImage(), and ~Image().

template<class T>
int Image<T>::getHeight ( ) const [inline]
 

Returns the image height.

Examples:
test_convol.cpp.

Definition at line 55 of file Image.h.

Referenced by ConnectedComponents(), Contrast(), Convolution(), Dilation(), DistanceTransform(), Downsample(), EdgeKirsch(), EdgePrewitt(), EdgeSobel(), Erosion(), FlatDilation(), FlatErosion(), FourierTransform::FourierTransform(), GradientMap(), LocalOp(), Noise(), Reflect(), Rotate(), Threshold(), Translate(), Upsample(), Watershed(), WaveletTransform::WaveletTransform(), Zoom(), byte2float(), byte2int(), Histogram::equalize(), FourierTransform::fft(), float2byte(), float2int(), FourierTransform::ifft(), int2byte(), int2float(), IntImage::operator=(), FloatImage::operator=(), ByteImage::operator=(), pad(), FourierTransform::showMagnitude(), and FourierTransform::showPhase().

template<class T>
char * Image<T>::getName ( ) [inline]
 

Returns the image name.

Definition at line 61 of file Image.h.

Referenced by Downsample(), Threshold(), Upsample(), Zoom(), byte2float(), byte2int(), float2byte(), float2int(), int2byte(), int2float(), IntImage::operator=(), FloatImage::operator=(), and ByteImage::operator=().

template<class T>
T * Image<T>::getPixels ( ) [inline]
 

Returns a pointer to the actual image buffer.

Definition at line 73 of file Image.h.

Referenced by ConnectedComponents(), Convolution(), FourierTransform::fft(), WaveletTransform::fwt(), FourierTransform::ifft(), WaveletTransform::ifwt(), IntImage::operator=(), FloatImage::operator=(), and ByteImage::operator=().

template<class T>
int Image<T>::getSize ( ) [inline]
 

Returns the image size - .

Definition at line 58 of file Image.h.

Referenced by ByteKernel::ByteKernel(), ConnectedComponents(), Convolution(), Histogram::Histogram(), HitOrMiss(), Magnitude(), Normalize(), Watershed(), avg(), clearImage(), dev(), IntImage::operator &=(), ByteImage::operator &=(), operator *=(), ByteKernel::operator!(), ByteImage::operator!(), operator!=(), operator()(), operator+=(), operator-=(), operator=(), operator==(), IntKernel::operator^(), ByteImage::operator^=(), IntImage::operator|=(), ByteImage::operator|=(), and setPixels().

template<class T>
int Image<T>::getWidth ( ) const [inline]
 

Returns the image width.

Examples:
test_convol.cpp.

Definition at line 52 of file Image.h.

Referenced by ConnectedComponents(), Contrast(), Convolution(), Dilation(), DistanceTransform(), Downsample(), EdgeKirsch(), EdgePrewitt(), EdgeSobel(), Erosion(), FlatDilation(), FlatErosion(), FourierTransform::FourierTransform(), GradientMap(), LocalOp(), Noise(), Reflect(), Rotate(), Threshold(), Translate(), Upsample(), Watershed(), WaveletTransform::WaveletTransform(), Zoom(), byte2float(), byte2int(), Histogram::equalize(), FourierTransform::fft(), float2byte(), float2int(), FourierTransform::ifft(), int2byte(), int2float(), IntImage::operator=(), FloatImage::operator=(), ByteImage::operator=(), pad(), FourierTransform::showMagnitude(), and FourierTransform::showPhase().

template<class T>
void Image< T >::makeImage<T> ( int w,
int h )
 

Allocates a buffer of size for storing the image data and sets the allocated memory to "0". Sets pixels to point out to the allocated buffer. If a buffer for storing image data was already allocated, it is freed.

Definition at line 78 of file Image.cpp.

Referenced by ByteKernel::ByteKernel(), ConnectedComponents(), DistanceTransform(), EdgeKirsch(), EdgePrewitt(), EdgeSobel(), FourierTransform::FourierTransform(), GradientMap(), Watershed(), crop(), makeEvenSized(), pad(), Kernel::readKernelCoeffs(), and setPixels().

template<class T>
void Image< T >::setName ( const char * name )
 

Sets the image name.

Examples:
test_conn_comp.cpp, test_contrast.cpp, test_downsampl.cpp, test_edge.cpp, test_image.cpp, test_localop.cpp, test_noise.cpp, test_reflect.cpp, test_rotate.cpp, test_thresh.cpp, test_translate.cpp, test_upsampl.cpp, and test_zoom.cpp.

Definition at line 73 of file Image.cpp.

Referenced by Image(), IntImage::operator=(), operator=(), FloatImage::operator=(), ByteImage::operator=(), readImage(), writeImage(), and ~Image().

template<class T>
void Image< T >::setPixels ( int w,
int h,
T * data )
 

Creates an image buffer of size and initializes it with the data in the buffer pointed by data.

Definition at line 96 of file Image.cpp.

Referenced by Convolution(), Image(), IntKernel::IntKernel(), IntImage::operator=(), operator=(), FloatImage::operator=(), ByteImage::operator=(), and readImage().


Member Data Documentation

template<class T>
int Image<T>::height [protected]
 

Stores the height of the current image.

Definition at line 28 of file Image.h.

template<class T>
char Image<T>::img_name [protected]
 

Stores the name of the current image. This name is used as a file name when the image is saved on / read from the disk.

Definition at line 34 of file Image.h.

template<class T>
T ** Image<T>::pixels [protected]
 

The image data is stored in a contiguous block of memory row by row. In order to simplify the access to each row, we built an array that stores pointers to the beginning of each row. The variable pixels stores a pointer this array. In other words, the variable pixels is a pointer to an array of pointers to each row in the current image. In this way, one can access the gray level in row i and column j using one of the following syntax: pixels[i][j] or pixels[0][i * width + j].

Definition at line 31 of file Image.h.

template<class T>
int Image<T>::width [protected]
 

Stores the width of the current image.

Definition at line 25 of file Image.h.


The documentation for this class was generated from the following files: