#include <qvcore/qvimage.h>
Inherited by QVImage< Type, Channels >.
Public Member Functions | |
QVGenericImage () | |
Default constructor. | |
QVGenericImage (QVGenericImage const &img) | |
Copy constructor. | |
virtual | ~QVGenericImage () |
virtual uInt | getCols () const =0 |
Virtual method for getting number of columns from image. | |
virtual uInt | getRows () const =0 |
Virtual method for getting number of rows from image. | |
virtual uInt | getStep () const =0 |
Virtual method for getting step from image. | |
virtual uInt | getChannels () const =0 |
Virtual method for getting number of planes for the image. | |
virtual uInt | getTypeSize () const =0 |
Virtual method for getting bit depth of the image, in bytes. | |
virtual uInt | getDataSize () const =0 |
Virtual method for getting data size for the image. | |
const QRect & | getROI () const |
Method for obtaining actual region of interest for image. | |
const QPoint & | getAnchor () const |
Obtains actual anchor for image. | |
void | resetROI () |
Resets the region of interest of the image. | |
void | erodeROI (uInt cols, uInt rows) |
Reduces the region of interest of the image, in a given amount of pixels. | |
void | dilateROI (uInt cols, uInt rows) |
Increments the region of interest of the image, in a given amount of pixels. | |
void | setROI (int x, int y, uInt w, uInt h) |
Sets dimensions and location of region of interest in an image. | |
void | setMarginROI (int margin) |
Sets the region of interest for an image, holding the whole image, except a border of a given width. | |
void | setROI (const QRect &rect) |
Directly sets the region of interest for an image, with a given rectangle. | |
void | resetAnchor () |
Sets anchor to pixel (0,0). | |
void | setAnchor (int col, int row) |
Sets anchor to a given pixel coordinates. | |
void | setAnchor (const QPoint &point) |
Directly sets anchor to a given pixel coordinates, given a point. | |
virtual const char * | getTypeQString () const =0 |
Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage. | |
bool | isCompatibleWith (const char *qvImageClassName) const |
Function to check whether an image is compatible with given image type id char string. | |
bool | isCompatibleWith (const QVGenericImage *image) const |
Function to check whether an image is compatible with this image. | |
Protected Attributes | |
QRect | roi |
QPoint | anchor |
For instance, this class is usefull to create code like this:
int imageAreaSize(QVGenericImage *image) { return image->getCols() * image->getRows(); }
Where it doesn't matter the bit depth or number of channels of the image, but the number of cols and rows of it, as well as generic containers, that can hold a variety of image types, for example:
class GenericImageContainer { public: int count; QVGenericImage *images; [...] void addImage(QVGenericImage *image) { images[count++] = ℑ } QVGenericImage getImage(int index) { return images[index]; } }
Thus, this class offers access methods for all kind of information about the image, like dimensions (see getCols() and getRows() methods), bit depth and number of planes (see getTypeSize() and getChannels() methods), ROI and anchor of the image (see getROI() and getAnchor() methods mainly), but pixel accessor methods, that are defined in the subclass QVImage, and depends on the bit depth and number of planes of the image.
Definition at line 121 of file qvimage.h.
QVGenericImage::QVGenericImage | ( | ) | [inline] |
QVGenericImage::QVGenericImage | ( | QVGenericImage const & | img | ) | [inline] |
virtual QVGenericImage::~QVGenericImage | ( | ) | [inline, virtual] |
Virtual destructor for QVGenericImage.
virtual uInt QVGenericImage::getCols | ( | ) | const [pure virtual] |
Virtual method for getting number of columns from image.
Implemented in QVImage< Type, Channels >.
Referenced by resetROI(), setAnchor(), setMarginROI(), and setROI().
virtual uInt QVGenericImage::getRows | ( | ) | const [pure virtual] |
Virtual method for getting number of rows from image.
Implemented in QVImage< Type, Channels >.
Referenced by resetROI(), setAnchor(), setMarginROI(), and setROI().
virtual uInt QVGenericImage::getStep | ( | ) | const [pure virtual] |
Virtual method for getting step from image.
This functions returns the distance in bytes between starts of consecutive lines in the image.
This may be not equal to a multiple of the number of columns, so this value is necessary to normal access to the image.
Implemented in QVImage< Type, Channels >.
virtual uInt QVGenericImage::getChannels | ( | ) | const [pure virtual] |
Virtual method for getting number of planes for the image.
Returned value should be equal to template parameter 'Channels', for any QVImage. This is the number of channels that can be accessed in the image.
Implemented in QVImage< Type, Channels >.
virtual uInt QVGenericImage::getTypeSize | ( | ) | const [pure virtual] |
Virtual method for getting bit depth of the image, in bytes.
Returned value should be equal to size of template parameter 'Type', for any QVImage. This is the size of any element of the data array that stores the image in memory.
Implemented in QVImage< Type, Channels >.
virtual uInt QVGenericImage::getDataSize | ( | ) | const [pure virtual] |
Virtual method for getting data size for the image.
This functions, for any image, returns the following value:
dataSize = rows * step * planes
Implemented in QVImage< Type, Channels >.
const QRect& QVGenericImage::getROI | ( | ) | const [inline] |
Method for obtaining actual region of interest for image.
The region of interest of an image is used for various operations over it. Check the manual for further documentation
Definition at line 187 of file qvimage.h.
References roi.
Referenced by Canny(), dilateROI(), draw(), erodeROI(), FastMarching(), Inpaint(), MinEigenVal(), and QVImage< Type, Channels >::operator==().
const QPoint& QVGenericImage::getAnchor | ( | ) | const [inline] |
Obtains actual anchor for image.
The anchor of an image is used for various operations over it. Check the manual for further documentation
Definition at line 195 of file qvimage.h.
References anchor.
Referenced by Canny(), FastMarching(), Inpaint(), and MinEigenVal().
void QVGenericImage::resetROI | ( | ) | [inline] |
Resets the region of interest of the image.
Makes the region of interest of the image hold the whole image.
That is, makes the region of interest be the rectangle which has upper left corner in pixel (0,0), and lower right corner in pixel (columns, rows), where columns and rows are the number of columns and rows of the image.
void QVGenericImage::erodeROI | ( | uInt | cols, | |
uInt | rows | |||
) | [inline] |
Reduces the region of interest of the image, in a given amount of pixels.
Adds cols and rows parameters to the top left corner of the region of interest, and those values doubled, to the width.
That is, reduces the region of interest in a border, of columns and rows indicated in the parameters.
cols | columns which should be reduced from the border of the roi. | |
rows | rows which should be reduced from the border of the roi. |
void QVGenericImage::dilateROI | ( | uInt | cols, | |
uInt | rows | |||
) | [inline] |
Increments the region of interest of the image, in a given amount of pixels.
Substracts cols and rows parameters to the top left corner of the region of interest, and those values doubled, to the width.
That is, increments the region of interest in a border, of columns and rows indicated in the parameters.
cols | columns which should be incremented to the border of the roi. | |
rows | rows which should be incremented to the border of the roi. |
void QVGenericImage::setROI | ( | int | x, | |
int | y, | |||
uInt | w, | |||
uInt | h | |||
) | [inline] |
Sets dimensions and location of region of interest in an image.
Region of interest for an image is a rectangle significant to many operations that can be done over an image.
It is defined by pixel where top left corner for this rectangle is located, and width & height of this rectangle.
x | column for the pixel where top left corner of the region of interest is located. | |
y | row for the pixel where top left corner of the region of interest is located. | |
w | width for the region of interest. | |
h | height for the region of interest. |
Definition at line 244 of file qvimage.h.
Referenced by Canny(), dilateROI(), erodeROI(), FastMarching(), Inpaint(), MinEigenVal(), QVImage< Type, Channels >::QVImage(), resetROI(), and setMarginROI().
void QVGenericImage::setMarginROI | ( | int | margin | ) | [inline] |
void QVGenericImage::setROI | ( | const QRect & | rect | ) | [inline] |
void QVGenericImage::setAnchor | ( | int | col, | |
int | row | |||
) | [inline] |
Sets anchor to a given pixel coordinates.
col | column of the pixel where the anchor is located. | |
row | row of the pixel where the anchor is located. |
Definition at line 275 of file qvimage.h.
Referenced by QVImage< Type, Channels >::QVImage(), resetAnchor(), and SobelCornerResponseImage().
void QVGenericImage::setAnchor | ( | const QPoint & | point | ) | [inline] |
virtual const char* QVGenericImage::getTypeQString | ( | ) | const [pure virtual] |
Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
Implemented in QVImage< Type, Channels >, QVImage< Type, Channels >, QVImage< Type, Channels >, QVImage< Type, Channels >, QVImage< Type, Channels >, QVImage< Type, Channels >, and QVImage< Type, Channels >.
Referenced by isCompatibleWith().
bool QVGenericImage::isCompatibleWith | ( | const char * | qvImageClassName | ) | const [inline] |
Function to check whether an image is compatible with given image type id char string.
This functions checks if this image has same bit depth and channel number, as the type of QVGenericImage represented by the parameter string.
Id char string can be that returned by getTypeQString() function, from another QVGenericImage, or one specified by the programmer.
This function is used to dynamic type introspection, to determine subclass of a QVGenericImage, and perform different functionality with it, depending on bit depth or number of planes. An example code for this use is below:
[...] QVImage image; [...] if(image->isCompatibleWith("QVImage<uChar,1>")) // do stuff with the uChar bit depth, one channel image ... else if(image->isCompatibleWith("QVImage<uChar,3>")) // do stuff with the uChar bit depth, three channel image ... [...] else // alternate code for that type of image ... [...]
qvimageClassName | char string identifying QVGenericImage type of an image. |
Definition at line 323 of file qvimage.h.
Referenced by isCompatibleWith().
bool QVGenericImage::isCompatibleWith | ( | const QVGenericImage * | image | ) | const [inline] |
Function to check whether an image is compatible with this image.
This functions checks if this image is compatible with a given image (that is, it has same bit depth and same number of channels).
Id char string can be that returned by getTypeQString() function, from another QVGenericImage, or one specified by the programmer.
image | image to check type with. |
Definition at line 339 of file qvimage.h.
References getTypeQString(), and isCompatibleWith().