Image Class Reference

Provides access and processing functions for an image. More...

#include <Image.h>


Iterators

There are const and non-const versions of iterators, which are returned by begin()/end() and beginw()/endw(), respectively. The "w" in beginw()/endw() is a mnemonic for "write" or "writeable".

typedef double * iterator
 Read/write iterator.
typedef const double * const_iterator
 Read-only iterator.
const_iterator begin () const
 Returns a read-only iterator to the beginning of the Image data.
const_iterator end () const
 Returns a read-only iterator to the one-past-the-end of the Image data.
iterator beginw ()
 Returns a read/write iterator to the beginning of the Image data.
iterator endw ()
 Returns a read/write iterator to the one-past-the-end of the Image data.

Public Member Functions

Constructors and initialization routines
An Image can be constructed from an existing two-dimensional Matlab array, or created empty, or constructed uninitialzed. In this case, the Image must be initialized before any operation with it is attempted. The copy constructor and assigment make true memory copies of the other image

 Image ()
 Contructor for an uninitialized Image.
 Image (const mxArray *arr)
 Constructor from a two-dimensional Matlab array.
 Image (const Image &other)
 Copy constructor.
 Image (const int w, const int h)
 Constructs a new empty Image with width w and height h.
Image operator= (const Image other)
 Copy assigment operator.
void initialize (const mxArray *arr)
 Initializes from a two-dimensional Matlab array.
void initialize (const int w, const int h)
 Initializes a new empty image with width w and height h.
Access functions.


int getWidth () const
 Returns the width of the Image.
int getHeight () const
 Returns the height of the Image.
int getSize () const
 Returns the number of pixels in the Image.
bool isInitialized () const
 Returns whether the Image is initialized.
mxArray * getArray ()
 Returns a pointer to the underlying Matlab array.
const mxArray * getConstArray () const
 Returns a constant pointer to the underlying Matlab array.
bool coordsOK (int x, int y) const
 Check if the coordinates are within the bounds of the Image.
double getVal (int index) const
 Returns a pixel value by index.
double getVal (int x, int y) const
 Returns a pixel value by coordinates.
void setVal (int index, double val)
 Sets a pixel value by index.
void setVal (int x, int y, double val)
 Sets a pixel value by coordinates.
Computation functions.


void clamp (const double bottom, const double top)
 Clamp the image between bottom and top.
void clampBottom (const double bottom)
 Clamp the image only at the bottom.
void clampTop (const double top)
 Clamp the image only at the top.
void getLocalMaxima (const double thresh, int *lm_num, double *lm_sum)
 Count and sum all local maxima above a threshold.
Image operator *= (const double factor)
 Multiply all values by a scalar factor.

Protected Attributes

bool itsInitialized
mxArray * itsArray


Detailed Description

Provides access and processing functions for an image.

An Image is an object-oriented abstraction of a two-dimensional Matlab array. The pixels are double values.

Definition at line 19 of file Image.h.


Member Typedef Documentation

typedef double* Image::iterator

Read/write iterator.

Definition at line 130 of file Image.h.

typedef const double* Image::const_iterator

Read-only iterator.

Definition at line 133 of file Image.h.


Constructor & Destructor Documentation

Image::Image (  ) 

Contructor for an uninitialized Image.

Definition at line 15 of file Image.cpp.

Image::Image ( const mxArray *  arr  ) 

Constructor from a two-dimensional Matlab array.

Definition at line 20 of file Image.cpp.

References initialize().

Here is the call graph for this function:

Image::Image ( const Image other  ) 

Copy constructor.

Definition at line 26 of file Image.cpp.

References getConstArray(), and initialize().

Here is the call graph for this function:

Image::Image ( const int  w,
const int  h 
)

Constructs a new empty Image with width w and height h.

Definition at line 32 of file Image.cpp.

References initialize().

Here is the call graph for this function:


Member Function Documentation

Image Image::operator= ( const Image  other  ) 

Copy assigment operator.

Definition at line 38 of file Image.cpp.

References getConstArray(), initialize(), isInitialized(), and itsInitialized.

Here is the call graph for this function:

void Image::initialize ( const mxArray *  arr  ) 

Initializes from a two-dimensional Matlab array.

Definition at line 47 of file Image.cpp.

References beginw(), and getSize().

Referenced by Image(), and operator=().

Here is the call graph for this function:

void Image::initialize ( const int  w,
const int  h 
)

Initializes a new empty image with width w and height h.

Definition at line 54 of file Image.cpp.

References itsArray, and itsInitialized.

int Image::getWidth (  )  const

Returns the width of the Image.

Definition at line 61 of file Image.cpp.

References ASSERT, getConstArray(), and isInitialized().

Referenced by conv2PreserveEnergy(), coordsOK(), getLocalMaxima(), lowPass6xDecX(), and lowPass6yDecY().

Here is the call graph for this function:

int Image::getHeight (  )  const

Returns the height of the Image.

Definition at line 68 of file Image.cpp.

References ASSERT, getConstArray(), and isInitialized().

Referenced by conv2PreserveEnergy(), coordsOK(), getLocalMaxima(), getVal(), lowPass6xDecX(), lowPass6yDecY(), and setVal().

Here is the call graph for this function:

int Image::getSize (  )  const

Returns the number of pixels in the Image.

Definition at line 75 of file Image.cpp.

References ASSERT, getConstArray(), and isInitialized().

Referenced by end(), endw(), getVal(), initialize(), and setVal().

Here is the call graph for this function:

bool Image::isInitialized (  )  const

Returns whether the Image is initialized.

Definition at line 106 of file Image.cpp.

References itsInitialized.

Referenced by clamp(), clampBottom(), clampTop(), conv2PreserveEnergy(), coordsOK(), getHeight(), getLocalMaxima(), getSize(), getVal(), getWidth(), operator *=(), operator=(), and setVal().

mxArray * Image::getArray (  ) 

Returns a pointer to the underlying Matlab array.

This version allows manipulation of the array from the outside.

Definition at line 112 of file Image.cpp.

References itsArray.

Referenced by beginw().

const mxArray * Image::getConstArray (  )  const

Returns a constant pointer to the underlying Matlab array.

This version prevents manipulation of the array from the outside.

Definition at line 118 of file Image.cpp.

References itsArray.

Referenced by begin(), getHeight(), getSize(), getWidth(), Image(), and operator=().

bool Image::coordsOK ( int  x,
int  y 
) const

Check if the coordinates are within the bounds of the Image.

Definition at line 222 of file Image.cpp.

References getHeight(), getWidth(), and isInitialized().

Referenced by getVal(), and setVal().

Here is the call graph for this function:

double Image::getVal ( int  index  )  const

Returns a pixel value by index.

Definition at line 161 of file Image.cpp.

References ASSERT, begin(), getSize(), and isInitialized().

Referenced by getLocalMaxima().

Here is the call graph for this function:

double Image::getVal ( int  x,
int  y 
) const

Returns a pixel value by coordinates.

Definition at line 169 of file Image.cpp.

References ASSERT, begin(), coordsOK(), and getHeight().

Here is the call graph for this function:

void Image::setVal ( int  index,
double  val 
)

Sets a pixel value by index.

Definition at line 177 of file Image.cpp.

References ASSERT, beginw(), getSize(), and isInitialized().

Here is the call graph for this function:

void Image::setVal ( int  x,
int  y,
double  val 
)

Sets a pixel value by coordinates.

Definition at line 185 of file Image.cpp.

References ASSERT, beginw(), coordsOK(), and getHeight().

Here is the call graph for this function:

void Image::clamp ( const double  bottom,
const double  top 
)

Clamp the image between bottom and top.

All values less than bottom are set to bottom; all values greater than top are set to top.

Definition at line 125 of file Image.cpp.

References ASSERT, beginw(), endw(), and isInitialized().

Here is the call graph for this function:

void Image::clampBottom ( const double  bottom  ) 

Clamp the image only at the bottom.

All values less than bottom are set to bottom.

Definition at line 136 of file Image.cpp.

References ASSERT, beginw(), endw(), and isInitialized().

Here is the call graph for this function:

void Image::clampTop ( const double  top  ) 

Clamp the image only at the top.

All values greater than top are set to top.

Definition at line 144 of file Image.cpp.

References ASSERT, beginw(), endw(), and isInitialized().

Here is the call graph for this function:

void Image::getLocalMaxima ( const double  thresh,
int *  lm_num,
double *  lm_sum 
)

Count and sum all local maxima above a threshold.

Parameters:
thresh the threshold for a local maximum.
lm_num returns the number of local maxima.
lm_sum returns the sum of the local maxima.

Definition at line 193 of file Image.cpp.

References ASSERT, getHeight(), getVal(), getWidth(), and isInitialized().

Here is the call graph for this function:

Image Image::operator *= ( const double  factor  ) 

Multiply all values by a scalar factor.

Definition at line 152 of file Image.cpp.

References ASSERT, beginw(), endw(), and isInitialized().

Here is the call graph for this function:

Image::const_iterator Image::begin (  )  const

Returns a read-only iterator to the beginning of the Image data.

Definition at line 82 of file Image.cpp.

References getConstArray().

Referenced by conv2PreserveEnergy(), end(), getVal(), lowPass6xDecX(), and lowPass6yDecY().

Here is the call graph for this function:

Image::const_iterator Image::end (  )  const

Returns a read-only iterator to the one-past-the-end of the Image data.

Definition at line 88 of file Image.cpp.

References begin(), and getSize().

Here is the call graph for this function:

Image::iterator Image::beginw (  ) 

Returns a read/write iterator to the beginning of the Image data.

Definition at line 94 of file Image.cpp.

References getArray().

Referenced by clamp(), clampBottom(), clampTop(), conv2PreserveEnergy(), endw(), initialize(), lowPass6xDecX(), lowPass6yDecY(), operator *=(), and setVal().

Here is the call graph for this function:

Image::iterator Image::endw (  ) 

Returns a read/write iterator to the one-past-the-end of the Image data.

Definition at line 100 of file Image.cpp.

References beginw(), and getSize().

Referenced by clamp(), clampBottom(), clampTop(), and operator *=().

Here is the call graph for this function:


Field Documentation

bool Image::itsInitialized [protected]

Definition at line 150 of file Image.h.

Referenced by initialize(), isInitialized(), and operator=().

mxArray* Image::itsArray [protected]

Definition at line 151 of file Image.h.

Referenced by getArray(), getConstArray(), and initialize().


The documentation for this class was generated from the following files:
Generated on Fri Sep 7 13:09:50 2007 for SaliencyToolbox by  doxygen 1.5.2