QVImage< Type, Channels > Class Template Reference

Image representation class for the QVision. More...

#include <qvcore/qvimage.h>

Inherits QVGenericImage.

List of all members.

Public Member Functions

 QVImage ()
 Default constructor.
 QVImage (uInt cols, uInt rows, uInt step=0, const Type *buffer=NULL)
 Dimensions and buffer constructor.
 QVImage (QVImage< uChar, 1 > const &img)
 Copy constructor.
 QVImage (QVImage< uChar, 3 > const &img)
 QVImage (QVImage< sShort, 1 > const &img)
 QVImage (QVImage< sShort, 3 > const &img)
 QVImage (QVImage< sFloat, 1 > const &img)
 QVImage (QVImage< sFloat, 3 > const &img)
const char * getTypeQString () const
uInt getRows () const
uInt getCols () const
uInt getStep () const
uInt getChannels () const
uInt getDataSize () const
uInt getTypeSize () const
const Type * getReadData () const
 Method to obtain image data buffer, in read mode.
Type * getWriteData ()
 Method to obtain image data buffer, in read/write mode.
void set (Type c1=0, Type c2=0, Type c3=0)
 Sets pixel values for an image, to a given value.
Type & operator() (const uInt col, const uInt row, const uInt channel=0)
 Operator to access pixel values for a pixel channel, given it's coordinates.
Type operator() (const uInt col, const uInt row, const uInt channel=0) const
Type & operator() (const QPoint point, const uInt channel=0)
 Overload of operator (), to access pixel values for a pixel channel, given a QVPoint and a channel number.
Type operator() (const QPoint point, const uInt channel=0) const
QVImage< Type,
Channels > & 
operator= (const QVImage< uChar, 1 > &sourceImage)
 Copy operator.
QVImage< Type,
Channels > & 
operator= (const QVImage< uChar, 3 > &sourceImage)
QVImage< Type,
Channels > & 
operator= (const QVImage< sShort, 1 > &sourceImage)
QVImage< Type,
Channels > & 
operator= (const QVImage< sShort, 3 > &sourceImage)
QVImage< Type,
Channels > & 
operator= (const QVImage< sFloat, 1 > &sourceImage)
QVImage< Type,
Channels > & 
operator= (const QVImage< sFloat, 3 > &sourceImage)
bool operator== (const QVImage< Type, Channels > &img) const
 Equality compare operator.
bool operator!= (const QVImage< Type, Channels > &img) const
 Inequality compare operator.
QVImage< uChar > operator< (const QVImage< Type, Channels > &img) const
 Pixel wise 'less than' compare operator.
QVImage< uChar > operator> (const QVImage< Type, Channels > &img) const
 Pixel wise 'greater than' compare operator.
QVImage< uChar > operator<= (const QVImage< Type, Channels > &img) const
 Pixel wise 'less or equal than' compare operator.
QVImage< uChar > operator>= (const QVImage< Type, Channels > &img) const
 Pixel wise 'greater or equal than' compare operator.
QVImage< Type, Channels > operator+ (const Type constant) const
 Pixel wise constant add operator.
QVImage< Type, Channels > operator * (const Type constant) const
 Pixel wise constant product operator.
QVImage< Type, Channels > operator- (const Type constant) const
 Pixel wise constant subtraction operator.
QVImage< Type, Channels > operator/ (const Type constant) const
 Pixel wise constant division operator.
QVImage< Type, Channels > operator<< (const Type constant) const
 Pixel wise bit-wise left shift operator.
QVImage< Type, Channels > operator>> (const Type constant) const
 Pixel wise bit-wise right shift operator.
QVImage< Type, Channels > operator! () const
 Pixel wise bit-wise NOT operation.
QVImage< Type, Channels > operator & (const Type constant) const
 Pixel wise bit-wise boolean and operator.
QVImage< Type, Channels > operator| (const Type constant) const
 Pixel wise bit-wise boolean or operator.
QVImage< Type, Channels > operator^ (const Type constant) const
 Pixel wise bit-wise boolean xor operator.
QVImage< Type, Channels > operator+ (const QVImage< Type, Channels > &img) const
 Pixel wise add operator.
QVImage< Type, Channels > operator * (const QVImage< Type, Channels > &img) const
 Pixel wise mult operator.
QVImage< Type, Channels > operator- (const QVImage< Type, Channels > &img) const
 Pixel wise subtraction operator.
QVImage< Type, Channels > operator/ (const QVImage< Type, Channels > &img) const
 Pixel wise division operator.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.
template<>
const char * getTypeQString () const
 Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Protected Attributes

QSharedDataPointer
< QVImageBuffer
< Type, Channels > > 
imageBuffer


Detailed Description

template<typename Type, int Channels = 1>
class QVImage< Type, Channels >

Image representation class for the QVision.

QVImage class extends QVGenericImage, and wraps image data in a simple and lightweight structure, easy to use. It is a template class, as you can see in the header of the class:

template <typename Type, int Channels = 1> class QVImage: public QVGenericImage 
        {
        [...]
        }
parametrized with the data type of the pixels in the image, and the number of channels that it contains.

Image Types

Image bit-depth.

When creating an image, it's bit-depth is specified with the first template argument Type.

Virtually, you can specify pixel types of any kind, but QVision has defined functionality to process pixels of the following types:

C++ type QVision type IPP type Bit depth
unsigned char uChar Ipp8u 8
unsigned short uShort Ipp16u 16
unsigned int uInt Ipp32u 32
signed char sChar Ipp8s 8
signed short sShort Ipp16s 16
signed int sInt Ipp32s 32
typedef float sFloat Ipp32f 32
typedef double sDouble Ipp64f 64

In practice, most of the functions will work with images of type uChar, sShort, and sFloat.

Number of channels in an image.

Each image stores a vector of values of type indicated in the first parameter of the template for each pixel, of size indicated in the second parameter of the template. The latter is called Channel number or simply Channels, and it indicates the number of channels in which the image stores the data.

For example, the following code line creates images of 8 bit-depth, 16 bit-depth, and 32 bit-depth, of one and three channels:

QVImage<uChar, 1> image8uC1;
QVImage<sShort, 1> image16sC1;
QVImage<sInt, 1> image32sC1;

QVImage<uChar, 3> image8uC3;
QVImage<sShort, 3> image16sC3;
QVImage<sInt, 3> image32sC3;

You can ommit the number of channels, if you want to create a one channel image, because that will be the default value for that template parameter. Thus the first three code lines of the previous example can be written like this:

QVImage<uChar> image8uC1;
QVImage<sShort> image16sC1;
QVImage<sInt> image32sC1;

with identic results.

As in the case of the Type parameter, this parameter can be assigned any arbitrary positive integer value, but generally there wouldn't be functionallity to work with images with a channel number different of one or three channels.

Conversion between image types.

When using the constructor and the assign operator with a source image different in type or channel number to the created or destination image respectively, QVision authomatically performs a conversion. Conversion generally calls to the proper ippConvert function, so a review to qvipp::Convert function is recommended for futher learning about this feature of QVImage objects.

Warning:
It is not possible to directly convert or construct an image from another one that differs in both type and in channel number. It should be converted to an intermediate image that shares the same number of channels and bit-depth than both images first.

Pixel access.

Access to pixel in the data buffer can be done in three different ways: using operator (), direct access to the data buffer, and using QVIMAGE_* macros.

Using operator ()

Operator () is overloaded in class QVImage to read pixel values, both to read and write pixels in the image. This is the least efficient access method in execution time performance, but the easiest one to use, and the safest. It performs some sanity checks, to avoid reading from a pixel outside the image (thus, also outside the image data buffer). An example of use follows:

QVImage<uChar> imageCharBis = imageChar;
[...]
// This line assigns the value 0 to pixel (10,10) in the image imageChar:
imageCharBis(10,10) = 0;
// And this line reads value of pixel (11,11) of the image imageChar in the variable value:
uChar value = imageCharBis(11,11);

[...]

// The following code shows how to read and write all the pixels from QVImage's of size 100x100:
QVImage<uChar> imageChar1(100,100), imageChar2(100,100);
[...]
for (uInt row = 0; row < imageChar1.getRows(); row++)
        for (uInt col = 0; col < imageChar1.getCols(); col++)
                imageCharData2(col, row) = imageCharData1(col, row);
[...]

Direct access through data buffer.

The data buffer of an image can be accessed directly with methods operator() getReadData() and getWriteData(), for reading or reading/writting access respectively. This way of accessing image pixels is the fastest, and the ugliest, also has some problems that will be noticed latter.

To access any pixel getStep(), getRows() and getCols() methods should be used, to get the width in bytes of the lines, the number of lines, and the number of valid elements in each line of the image data buffer, respectively. Follows an example of directly accessing the data buffer of an image using these methods:

QVImage<uChar> imageChar1(100,100), imageChar2(100, 100);
[...]
uInt            step1 = imageChar1.getStep(), step2 = imageChar2.getStep();
uChar           *imageCharData1 = imageChar1.getReadData(),
        const   *imageCharData2 = imageChar2.getWriteData();

for (uInt row = 0; row < imageChar1.getRows(); row++)
        for (uInt col = 0; col < imageChar1.getCols(); col++)
                imageCharData2[row*step2 + col] = imageCharData1[row*step1 + col];
[...]

Warning:
If you keep a pointer to the buffer data of an image after using a method or function that modifes it, it can become obsolete, due to copy-on-write. EXPLICAR MEJOR ESTO.

Using macros QVIMAGE_INIT_*, and QVIMAGE_PIXEL.

This is the last way of pixel reading/writting on an image, and is a compromise between code simplicity and execution time performance.

Macro QVIMAGE_PIXEL can be used to access a pixel from an image previously initialized to be used with that macro, with macros QVIMAGE_INIT_READ and QVIMAGE_INIT_WRITE. An example of this follows:

QVImage<sFloat, 1> imageFloat(100,100);
QVImage<uChar, 3> imageChar3(100,100);
[...]
QVIMAGE_INIT_READ(sFloat,imageFloat);
QVIMAGE_INIT_WRITE(uChar,imageChar3);
for(uInt row = 0; row < imageFloat.getRows(); row++)
        for(uInt col = 0; col < imageFloat.getCols(); col++)
                QVIMAGE_PIXEL(imageChar3, col, row,1) = QVIMAGE_PIXEL(imageFloat, col, row,0);
[...]

Macro QVIMAGE_PIXEL always takes 4 parameters: image name, row, column, and channel number, starting with number 0 for the first channel. In one channel images, only 0 value should be valid for this last parameter.

Macros QVIMAGE_PTR_INIT_READ and QVIMAGE_PTR_INIT_WRITE work like macros QVIMAGE_INIT_READ and QVIMAGE_INIT_WRITE, only that they are given a pointer to the image to be accessed with macro QVIMAGE_PIXEL, not the name of the image itselft. An example of use of these macros follows:

QVImage<sFloat, 1> * ptrImageFloat(100,100);
QVImage<uChar, 3> * ptrImageChar3(100,100);
[...]
QVIMAGE_PTR_INIT_READ(sFloat,ptrImageFloat);
QVIMAGE_PTR_INIT_WRITE(uChar,ptrImageChar3);
for(uInt row = 0; row < ptrImageFloat.getRows(); row++)
        for(uInt col = 0; col < ptrImageFloat.getCols(); col++)
                QVIMAGE_PIXEL(ptrImageChar3, col, row,1) = QVIMAGE_PIXEL(ptrImageFloat, col, row,0);
[...]

Use of macro QVIMAGE_PIXEL is the same for all of the initialization macros.

Warning:
As with the direct access method, this one can save an old copy to the pointer of the image data buffer, if the image is accessed in write mode after being initialized.

Regions of interest (or ROI's) and anchors

These are two properties defined in the class QVGenericImage, so they are inherited by class QVImage. They are very relevant for image processing functionality, in a way that restrict the area of the input image, to a rectangular area inside the image, and the destination location of the updated area in the resulting image, for an image processing method or function.

When using functions that modify the content of an image, sometimes they don't change the whole content of the image, but a small area inside it. Generally, that fraction has rectangular shape, and is called region of interest, or ROI. For instance that happens with some functions from the package qvipp, like qvipp::FilterGauss, in which the area modified in the resulting image is smaller in size than the area processed in the input image, by a margin of size the width of the convolution filter matrix used.

Also, it could be convenient that only the modifed area were considered by following image functions when using that filtered image as an input image. That's why the information about the ROI is stored in the image, from one operation to another, in a way that is transparent to the programmer.

Originally, every image is created with a ROI that contains the whole image. In latter operations, that ROI may change in size, normally decreasing.

When the destination ROI of the operation over an image is smaller than the image, it should be specified were to locate the resulting area in the image. Generally, the resulting ROI of any operation will be placed in the top left corner of the image, but in some cases can be interest to locate it elsewere in the image. That position can be specified previously to operations with the anchor property.

ROI usage

The ROI of an image is stored in the class QVGenericImage as a QRect object. All of the functions in the qvipp package, and many functions from the qvdta package take use of the ROI value in their operations. That means they only process the area of the source images contained in the ROI. An example code for this follows:

[...]

QVImage<uChar> sourceImage = tajMajal;
sourceimage.setROI(10,10,90,90);        // This specifies an anchor vector for destination image.

QVImage<uChar> destinationImage(200, 200);
qvipp::Copy(sourceimage, destinationImage);

[...]

Figure below shows the result of aplying that code to a given picture. On the left is the source image, with the specified ROI depicted as a hollow rectangle. On the right is the destination image as it is left by the code. We see that the content of the ROI area has been copied to the top left corner of the destination image:

tajmajalcopyroi.png

When using functions that operate over an input image and store the result of their operations on an output image of bigger size, it could be convenient to indicate that not all of the pixels in the output image contain values derived from the input image. In other cases for some image functions, mainly filtering functions such as qvipp::FilterGauss, qvipp::FilterMedian, even if both input and output images have the same size not all of the pixels of the resulting image have values derived from the input image.

It is denoted by valid data to the set of pixels in the image returned or modified by a function, that depend on the input image (or images) of the function, or were modified by that function, and are considered to contain relevant data.

The main function of the ROI is not restricting manually the working area for image functions, but storing the area that contains valid data in the return image. Any function that returns an image should store in its ROI the rectangular area of valid data that it wrote on the image.

An example of why is usefull to keep the ROI in the resulting images after operations follows:

[...]

QVImage<uChar> sourceImage = lena;
sourceImage.setROI(100, 110, 90, 40);   // This specifies an initial ROI for source image.

QVImage<uChar> temporaryImage(256, 256);
qvipp::FilterGauss(sourceImage, temporaryImage, 5);

QVImage<uChar> destinationImage(256, 256);
qvipp::FilterGauss(temporaryImage, destinationImage, 5);

[...]

You can see the results of aplying that code to an input image in the following figure:

lenagauss_5_5roi.png

On the left is the source image, with the starting ROI depicted as a hollow rectangle. On the right is the destination image as it is left by the code. In the middle is depicted the temporary image. We see that the function qvipp::FilterGauss modifes an area of the resulting image that is 4 pixels smaller in width and height than the input image, if used a mask of size 5.

Storing the ROI between calls to that function, in the intermediate images, allows to aboid specifying the valid area size and location in the image for each call to the filtering function.

Anchor usage

The anchor is a vector of two coordinates, stored in the class QVGenericImage as a QPoint value. Functions that make use of ROI and anchor of the images should write their result in the resulting image starting at the pixel indicated by the anchor. You can see that in the following code:

[...]

QVImage<uChar> sourceImage = tajMajal;
sourceImage.setROI(10,10,90,90);                // This specifies an initial ROI for source image.

QVImage<uChar> destinationImage(200, 200);
destinationImage.setAnchor(60,30);              // This specifies an anchor vector for destination image.

qvipp::Copy(sourceImage, destinationImage);

[...]

Result of using that code with Taj Majal image from the previous examples is depicted in the following figure:

tajmajalcopyroianchor.png

You can see that the output ROI of the destination image has the top left corner in the pixel pointed by the anchor. Not like the example in section ROI usage, where the destination ROI started at the top left corner of the image. You can see that you should specify the anchor in the output image for the image function to make use of it.

Combining use of ROI and Anchor in several images

When using multiple image input functions, generally the ROI of all of them should have the same size, and may be located anywhere in the image. Following code will show it:

[...]

QVImage<uChar>  sourceImage1 = lena,            // lena is an image of size 256x256
                sourceImage2 = tajMajal;        // tajMajal is an image of size 200x200
sourceImage1.setROI(45,65,155,85);              // This specifies an initial ROI for image sourceImage1.
sourceImage2.setROI(30,20,155,85);              // This specifies an initial ROI for image sourceImage2.

QVImage<uChar> destinationImage(230,230);       // destinationImage is an image of size 230x230
destinationImage.setAnchor(10,20);              // This specifies an anchor vector for image destinationImage.

qvipp::Add(sourceImage1, sourceImage2, destinationImage);

[...]

This figure shows the result of using both Lena and Taj Majal images with that code:

tajmajallenacopyroianchor.png

In this case function qvipp::Add gets the contents of the ROI's of both input images and writes in the output image, starting at the pixel pointed by the anchor of the output image, the mean of every two pixels in the ROI's of the input images (add function uses by default a factor of 0.5 for the sum of the pixels).

Warning:
As it is said, ROI and anchor properties mainly affect functions in the packages qvipp and qvdta, and not to all of them. They do not affect pixel accessing methods described in previous section Pixel access., nor image display using QVImageCanvas viewer.

Definition at line 614 of file qvimage.h.


Constructor & Destructor Documentation

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage (  )  [inline]

Default constructor.

Initializes image with a data buffer of size 1x1. Sets anchor to pixel (0,0), and region of interest to a rectangle containing the only pixel of the image.

Definition at line 622 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer, QVGenericImage::setAnchor(), and QVGenericImage::setROI().

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( uInt  cols,
uInt  rows,
uInt  step = 0,
const Type *  buffer = NULL 
) [inline]

Dimensions and buffer constructor.

Deprecated:
You shouldn't be able to specify a pointer to a buffer. If you need a image data buffer, create an image, and use it's. Creates an image of dimension cols x rows, and optionally you can define a given step for the image. If buffer points to a region of memory, it will use that region as image data. Step paramameter should be the width of the lines in the data buffer, if the parameter buffer points to a data buffer in memory.
An example of this can be seen in the following code:

                uChar data_buffer[10][12] =     {
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 },
                                                { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 3, 7 }
                                                };
                
                // Creates a QVImage of size 10x10, ROI covering the whole image, and anchor pointing at pixel (0,0).
                // Data buffer of the image will point to matrix data_buffer.
                
                // The final values of each line, those in 11th and 12th columns will not be considered as part of the
                // image. Step is the length of the lines of data_buffer, 12, not the number of columns.
                QVImage<uChar> imageCharBuffer(10,10, 12, data_buffer);

Parameters:
cols number of columns for the image.
rows number of rows for the image.
step defined step for the data buffer of the image. It should always be greater than the number of columns.
buffer pointer to a memory zone where image is and will be stored.

Definition at line 665 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer, QVGenericImage::setAnchor(), and QVGenericImage::setROI().

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< uChar, 1 > const &  img  ) 

Copy constructor.

This constructor can be used to construct an image from another one with same bit depth and channel number, or from an image differing in type or number of channels.

In the former case, this constructor will do a copy-on-write, duplicating the pointer to the data buffer of the image, and efectively copying the data only when modifying it if shared by more than one QVImage object.

In the latter case, it will always allocate a new data buffer for the image, and make a conversion from different bit depth or channel number. Note that you can never convert from an image that differs in data type and bit-depth with the constructed image.

This constructor will copy the ROI and anchor of the parameter image.

Parameters:
img image to be copied.

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< uChar, 3 > const &  img  ) 

Overloaded copy constructor.

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< sShort, 1 > const &  img  ) 

Overloaded copy constructor.

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< sShort, 3 > const &  img  ) 

Overloaded copy constructor.

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< sFloat, 1 > const &  img  ) 

Overloaded copy constructor.

template<typename Type, int Channels = 1>
QVImage< Type, Channels >::QVImage ( QVImage< sFloat, 3 > const &  img  ) 

Overloaded copy constructor.


Member Function Documentation

template<typename Type, int Channels = 1>
const char* QVImage< Type, Channels >::getTypeQString (  )  const [virtual]

Overloaded function from QVGenericImage::getTypeQString()

Implements QVGenericImage.

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getRows (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getRows()

Implements QVGenericImage.

Definition at line 709 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by qvdta::CountingSort(), qvdta::FilterLocalMax(), qvdta::getMSERContours(), qvdta::HarrisCornerResponseImage(), qvdta::myFloodFill(), QVImage< Type, Channels >::operator()(), QVImage< Type, Channels >::operator==(), qvdta::QVComponentTree::QVComponentTree(), and qvdta::SobelCornerResponseImage().

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getCols (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getCols()

Implements QVGenericImage.

Definition at line 712 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by qvdta::CountingSort(), qvdta::FilterLocalMax(), qvdta::getMSERContours(), qvdta::HarrisCornerResponseImage(), qvdta::myFloodFill(), QVImage< Type, Channels >::operator()(), QVImage< Type, Channels >::operator==(), qvdta::QVComponentTree::QVComponentTree(), and qvdta::SobelCornerResponseImage().

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getStep (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getStep()

Implements QVGenericImage.

Definition at line 715 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by qvipp::Canny(), qvipp::FastMarching(), qvipp::HistogramRange(), qvipp::Inpaint(), qvipp::MinEigenVal(), and QVImage< Type, Channels >::operator()().

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getChannels (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getChannels()

Implements QVGenericImage.

Definition at line 718 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by QVImage< Type, Channels >::operator==().

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getDataSize (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getDataSize()

Implements QVGenericImage.

Definition at line 721 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by QVImage< Type, Channels >::operator()().

template<typename Type, int Channels = 1>
uInt QVImage< Type, Channels >::getTypeSize (  )  const [inline, virtual]

Overloaded function from QVGenericImage::getTypeSize()

Implements QVGenericImage.

Definition at line 724 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

template<typename Type, int Channels = 1>
const Type* QVImage< Type, Channels >::getReadData (  )  const [inline]

Method to obtain image data buffer, in read mode.

This method can be used to program fast access algorithms to pixel values in an image.

It is intended to be used only to read pixels in an image, thus getWriteData() method should be used when access to write or read/write is intended to be done.

This function will generally be faster than getWriteData(), because it will not need to realize copy on write, in the case that the image data buffer where shared with other QVImage.

Definition at line 736 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by qvipp::Inpaint().

template<typename Type, int Channels = 1>
Type* QVImage< Type, Channels >::getWriteData (  )  [inline]

Method to obtain image data buffer, in read/write mode.

This method can be used to program fast access algorithms to pixel values in an image.

This function will perform copy on write in the case that the data buffer for this image where shared with other QVImage's.

Thus can be slower than getReadData() method to access image pixels, but will ensure avoiding side effects on modifying shared buffers with other images.

Definition at line 748 of file qvimage.h.

References QVImage< Type, Channels >::imageBuffer.

Referenced by qvipp::Canny(), qvipp::FastMarching(), and qvipp::MinEigenVal().

template<typename Type, int Channels = 1>
void QVImage< Type, Channels >::set ( Type  c1 = 0,
Type  c2 = 0,
Type  c3 = 0 
)

Sets pixel values for an image, to a given value.

This method uses the region of interest of the image, to set pixels inside it to a given value. It can be used either for one channel, or several channel images.

In the former case, it should be used with one parameter, only specifying value for the first channel, otherwise, values for other channels will be ignored. If no parameters are given, the image region of interest will be set to zero value pixels.

In the latter case, default values of 0 will be used if there are unspecified channel values.

Parameters:
c1 value to set pixel's first channel in the region of interest of the image.
c2 value to set pixel's second channel in the region of interest of the image.
c3 value to set pixel's third channel in the region of interest of the image.

template<typename Type, int Channels = 1>
Type& QVImage< Type, Channels >::operator() ( const uInt  col,
const uInt  row,
const uInt  channel = 0 
) [inline]

Operator to access pixel values for a pixel channel, given it's coordinates.

This operator can be used either with one channel or multichannel images. In the first case, it shouldn't be given a channel number, to use the default zero value.

Parameters:
col column number of pixel to be accessed.
row row number of pixel to be accessed.
channel channel number of pixel to be accessed.

Definition at line 774 of file qvimage.h.

References QVImage< Type, Channels >::getCols(), QVImage< Type, Channels >::getDataSize(), QVImage< Type, Channels >::getRows(), QVImage< Type, Channels >::getStep(), and QVImage< Type, Channels >::imageBuffer.

template<typename Type, int Channels = 1>
Type& QVImage< Type, Channels >::operator() ( const QPoint  point,
const uInt  channel = 0 
) [inline]

Overload of operator (), to access pixel values for a pixel channel, given a QVPoint and a channel number.

This overload is like the previous, but can be used with a QPoint, to access a concrete pixel in the image.

Parameters:
point QPoint indicating location of the pixel to be accessed.
channel channel number of pixel to be accessed.

Definition at line 808 of file qvimage.h.

References QVImage< Type, Channels >::getCols(), QVImage< Type, Channels >::getDataSize(), QVImage< Type, Channels >::getRows(), QVImage< Type, Channels >::getStep(), and QVImage< Type, Channels >::imageBuffer.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< uChar, 1 > &  sourceImage  ) 

Copy operator.

Like the copy constructor, this operator can be used to copy an image from another one with same bit depth and channel number, or from an image differing in type or number of channels.

In the former case, this operator will do a copy-on-write, duplicating the pointer to the data buffer of the image, and efectively copying the data only when modifying it if shared by more than one QVImage object.

In the latter case, it will always allocate a new data buffer for the image, and make a conversion from different bit depth or channel number. Note that you can never convert from an image that differs in data type and bit-depth with the constructed image.

The copy operator will copy the ROI and anchor of the parameter image.

Parameters:
img image to be copied.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< uChar, 3 > &  sourceImage  ) 

Overloaded copy operator.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< sShort, 1 > &  sourceImage  ) 

Overloaded copy operator.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< sShort, 3 > &  sourceImage  ) 

Overloaded copy operator.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< sFloat, 1 > &  sourceImage  ) 

Overloaded copy operator.

template<typename Type, int Channels = 1>
QVImage<Type, Channels>& QVImage< Type, Channels >::operator= ( const QVImage< sFloat, 3 > &  sourceImage  ) 

Overloaded copy operator.

template<typename Type, int C>
bool QVImage< Type, C >::operator== ( const QVImage< Type, C > &  img  )  const [inline]

Equality compare operator.

This operator will compare two images of same bit depth and channel number, and will return true if images are equal in all of these:

Parameters:
img image to compare with this image.

Definition at line 1061 of file qvimage.h.

References QVImage< Type, Channels >::getChannels(), QVImage< Type, Channels >::getCols(), QVGenericImage::getROI(), QVImage< Type, Channels >::getRows(), QVIMAGE_INIT_READ, QVIMAGE_PIXEL, and QVIMAGE_PTR_INIT_READ.

template<typename Type, int Channels = 1>
bool QVImage< Type, Channels >::operator!= ( const QVImage< Type, Channels > &  img  )  const [inline]

Inequality compare operator.

This operator will compare two images of same bit depth and channel number, and will return true if images differ in any of:

Todo:
Shouldn't ignore dimensions in caparisons, and only check if region of interest content are the same?
Parameters:
img image to compare with this image.
Returns:
true if images are practically equal (same content of region of interest and dimensions).

Definition at line 894 of file qvimage.h.

template<typename Type, int Channels = 1>
QVImage<uChar> QVImage< Type, Channels >::operator< ( const QVImage< Type, Channels > &  img  )  const

Pixel wise 'less than' compare operator.

Parameters:
img image to compare with this image.
Returns:
1-channel uChar bit depth image containing non-zero values for pixels which value for corresponding pixel in this image is less than value for corresponding pixel in given image.

template<typename Type, int Channels = 1>
QVImage<uChar> QVImage< Type, Channels >::operator> ( const QVImage< Type, Channels > &  img  )  const

Pixel wise 'greater than' compare operator.

Parameters:
img image to compare with this image.
Returns:
1-channel uChar bit depth image containing non-zero values for pixels which value for corresponding pixel in this image is greater than value for corresponding pixel in given image.

template<typename Type, int Channels = 1>
QVImage<uChar> QVImage< Type, Channels >::operator<= ( const QVImage< Type, Channels > &  img  )  const

Pixel wise 'less or equal than' compare operator.

Parameters:
img image to compare with this image.
Returns:
1-channel uChar bit depth image containing non-zero values for pixels which value for corresponding pixel in this image is less or equal than value for corresponding pixel in given image.

template<typename Type, int Channels = 1>
QVImage<uChar> QVImage< Type, Channels >::operator>= ( const QVImage< Type, Channels > &  img  )  const

Pixel wise 'greater or equal than' compare operator.

Parameters:
img image to compare with this image.
Returns:
1-channel uChar bit depth image containing non-zero values for pixels which value for corresponding pixel in this image is greater or equal than value for corresponding pixel in given image.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator+ ( const Type  constant  )  const

Pixel wise constant add operator.

Uses as the second operand a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator * ( const Type  constant  )  const

Pixel wise constant product operator.

Uses as the second operand a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator- ( const Type  constant  )  const

Pixel wise constant subtraction operator.

Uses as the second operand a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator/ ( const Type  constant  )  const

Pixel wise constant division operator.

Uses as the second operand a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator<< ( const Type  constant  )  const

Pixel wise bit-wise left shift operator.

Uses as the value to shift a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator>> ( const Type  constant  )  const

Pixel wise bit-wise right shift operator.

Uses as the value to shift a constant value for every pixel computed.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator! (  )  const

Pixel wise bit-wise NOT operation.

Regions of interests, and anchors are applied in this operator.

Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator & ( const Type  constant  )  const

Pixel wise bit-wise boolean and operator.

Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator| ( const Type  constant  )  const

Pixel wise bit-wise boolean or operator.

Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator^ ( const Type  constant  )  const

Pixel wise bit-wise boolean xor operator.

Regions of interests, and anchors are applied in this operator.

Parameters:
constant second operand value.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator+ ( const QVImage< Type, Channels > &  img  )  const

Pixel wise add operator.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
img operand image.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator * ( const QVImage< Type, Channels > &  img  )  const

Pixel wise mult operator.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
img operand image.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator- ( const QVImage< Type, Channels > &  img  )  const

Pixel wise subtraction operator.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
img operand image.
Returns:
resulting image for the operation.

template<typename Type, int Channels = 1>
QVImage<Type, Channels> QVImage< Type, Channels >::operator/ ( const QVImage< Type, Channels > &  img  )  const

Pixel wise division operator.

Saturation is used for integer bit depth data (any except sFloat bit depth). Regions of interests, and anchors are applied in this operator.

Parameters:
img operand image.
Returns:
resulting image for the operation.

template<>
const char * QVImage< uChar, 1 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 28 of file qvimage.cpp.

template<>
const char * QVImage< uChar, 3 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 29 of file qvimage.cpp.

template<>
const char * QVImage< sShort, 1 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 30 of file qvimage.cpp.

template<>
const char * QVImage< sShort, 3 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 31 of file qvimage.cpp.

template<>
const char * QVImage< sFloat, 1 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 32 of file qvimage.cpp.

template<>
const char * QVImage< sFloat, 3 >::getTypeQString (  )  const [inline, virtual]

Function to make introspection in the image, and obtain a char string identifying the type of the real image contained in the QVGenericImage.

Returns:
pointer to a constant char string identifying image type.

Implements QVGenericImage.

Definition at line 33 of file qvimage.cpp.


The documentation for this class was generated from the following file:
Generated on Wed Jan 16 18:41:29 2008 for QVision by  doxygen 1.5.3