#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 | |
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 |
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.
typedef double* Image::iterator |
typedef const double* Image::const_iterator |
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:
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 | ) |
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 | ( | ) |
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 | |||
) |
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 | |||
) |
void Image::clampBottom | ( | const double | bottom | ) |
void Image::clampTop | ( | const double | top | ) |
void Image::getLocalMaxima | ( | const double | thresh, | |
int * | lm_num, | |||
double * | lm_sum | |||
) |
Count and sum all local maxima above a threshold.
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 | ) |
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 |
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:
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().