Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qgar::GenConvolImage< T, CheckingPolicy > Class Template Reference
[Convolutions]

#include <qgarlib/GenConvolImage.H>

Inheritance diagram for qgar::GenConvolImage< T, CheckingPolicy >:

qgar::GenImage< T, CheckingPolicy > CheckingPolicy List of all members.

Detailed Description

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
class qgar::GenConvolImage< T, CheckingPolicy >

Convolution of an image by a 1D or 2D mask.

The code implementing this class is an adaptation of code written by Carsten Steger at TU Muenchen, Germany. Here is the corresponding copyright notice:

 +----------------------------------------------------------------------+
 | Copyright (C) 1996 Carsten Steger                                    |
 |                                                                      |
 | This program is free software; you can redistribute it and/or modify |
 | it under the terms of the GNU General Public License as published by |
 | the Free Software Foundation; either version 2, or (at your option)  |
 | any later version.                                                   |
 |                                                                      |
 | This program is distributed in the hope that it will be useful, but  |
 | WITHOUT ANY WARRANTY; without even the implied warranty of           |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
 | General Public License for more details.                             |
 |                                                                      |
 | You should have received a copy of the GNU General Public License    |
 | along with this program; if not, write to the Free Software          |
 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.            |
 +----------------------------------------------------------------------+

All computation are made using the double format.

Author:
Karl Tombre
Date:
January 5, 2004 15:28
Since:
Qgar 2.1.1

Definition at line 99 of file GenConvolImage.H.

Public Types

Types
typedef T value_type
 Type of the elements stored in the pixmap.
typedef value_typereference
 Reference to qgar::GenConvolImage::value_type.
typedef const value_typeconst_reference
 Constant reference to qgar::GenConvolImage::value_type.
typedef value_typepointer
 Pointer to qgar::GenConvolImage::value_type.
typedef const value_typeconst_pointer
 Constant pointer to qgar::GenConvolImage::value_type.

Public Member Functions

 GenImage ()
 Default constructor.
 GenImage (unsigned int aWidth, unsigned int aHeight)
 Initialize with given width and height.
 GenImage (unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap) throw (QgarErrorInvalidArg)
 Initialize from a pixmap.
 GenImage (const GenImage &anImg)
 Copy constructor.
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Conversion of an image of the same type, using policies.
 GenImage (const GenImage< U, UCheckPolicy > &anImg)
 Initialize from an image with pixels of a type different from T.
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg, const BoundingBox &aBox, value_type aPixVal=static_cast< value_type >(0))
 Initialize by copying a rectangular area, defined by a bounding box, of a given image.
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg, unsigned int aXTopLeft, unsigned int aYTopLeft, unsigned int aXBottomRight, unsigned int aYBottomRight, value_type aPixVal=static_cast< value_type >(0))
 Initialize by copying a rectangular area, defined by the coordinates of its top left and bottom right corners, of a given image.
 GenImage (AbstractPbmPlusFile &aPbmPlusFile)
 Initialize with an image in a PBM+ file.
int width () const
 Get the image width.
int height () const
 Get the image height.
int bytesPerPixel () const
 Get the number of bytes per pixel.
value_type pixel (unsigned int aX, unsigned int aY) const
 Get a pixel value.
void row (unsigned int aRowIdx, pointer aRow) const
 Get a row of pixels.
void column (unsigned int aColIdx, pointer aCol) const
 Get a column of pixels.
pointer pPixel (unsigned int aRowIdx, unsigned int aColIdx) const
 Get a pointer on a given pixel of the image.
pointer pRow (unsigned int aRowIdx) const
 Get a pointer on a row of pixels.
pointer pColumn (unsigned int aColIdx) const
 Get a pointer on a column of pixels.
pointer pPixMap () const
 Get the pointer to the pixel map.
void setPixel (unsigned int aX, unsigned int aY, value_type aPixVal)
 Set a pixel value.
void setRow (unsigned int aRowIdx, const_pointer const aRow)
 Set a given row of pixels.
void setColumn (unsigned int aColIdx, const_pointer const aCol)
 Set a given column of pixels.
void draw (const Segment &aSeg, value_type aPixVal=(value_type) 1)
 Draw a segment in the pixel map.
GenImage shallowCopy ()
 Shallow copy: The pixel map of the current image is not duplicated.
GenImage< value_type, GenImage_NoCheckoperator+ (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::plus.
GenImageoperator+= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::plusEqual.
GenImage< value_type, GenImage_NoCheckoperator- (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::minus.
GenImageoperator-= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::minusEqual.
GenImage< value_type, GenImage_NoCheckoperator * (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::times.
GenImageoperator *= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::timesEqual.
GenImage< value_type, GenImage_NoCheckplus (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Add each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
GenImageplusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Add a given image to the current image.
GenImage< value_type, GenImage_NoCheckminus (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Subtract each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
GenImageminusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Subtract a given image to the current image.
GenImage< value_type, GenImage_NoChecktimes (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Multiply each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
GenImagetimesEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Multiply a given image by the current image.
void save (AbstractPbmPlusFile &aPbmPlusFile) const
 Store current image into a PBM+ file.
int borderRows (int aRowIdx) const
 Mirror border rows for convolutions.
int borderCols (int aColIdx) const
 Mirror border columns for convolutions.
Constructors
template<class ImageType, template< class > class ImageCheckPolicy, class MaskType>
 GenConvolImage (const GenImage< ImageType, ImageCheckPolicy > &anImg, const GenMask1d< MaskType > &aMask, QGEaxis anAxis)
 Convolution of an image and a 1D mask.
template<class ImageType, template< class > class ImageCheckPolicy>
 GenConvolImage (const GenImage< ImageType, ImageCheckPolicy > &anImg, const GenMask1d< double > &aMask, QGEaxis anAxis)
 Convolution of an image and a 1D mask.
template<class ImageType, template< class > class ImageCheckPolicy, class MaskType>
 GenConvolImage (const GenImage< ImageType, ImageCheckPolicy > &anImg, const GenMask2d< MaskType > &aMask)
 Convolution of an image and a 2D mask.
template<class ImageType, template< class > class ImageCheckPolicy>
 GenConvolImage (const GenImage< ImageType, ImageCheckPolicy > &anImg, const GenMask2d< double > &aMask)
 Convolution of an image and a 2D mask.
 GenConvolImage (const GenConvolImage &other)
 Copy constructor.
Destructor
virtual ~GenConvolImage ()
 Virtual destructor.

Protected Member Functions

 GenImage (unsigned int aBytesCnt, int *aPtRefCnt, unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap)
 Initialize from all data.
void copyBox (const GenImage< value_type, CheckingPolicy > &anImg, unsigned int aXTopLeft, unsigned int aYTopLeft, unsigned int aXBottomRight, unsigned int aYBottomRight, value_type aPixVal=static_cast< value_type >(0))
 Copy a rectangular area of the given image into the current image.
1D convolutions
template<class ImageType, template< class > class ImageCheckPolicy>
void xconvol (const GenImage< ImageType, ImageCheckPolicy > &anImg, const DMask1d &aMask)
 Convolve and image along X axis with a 1D mask.
template<class ImageType, template< class > class ImageCheckPolicy>
void yconvol (const GenImage< ImageType, ImageCheckPolicy > &anImg, const DMask1d &aMask)
 Convolve along Y axis with a 1D mask.
2D convolutions
template<class ImageType, template< class > class ImageCheckPolicy>
void convol (const GenImage< ImageType, ImageCheckPolicy > &anImg, const DMask2d &aMask)
 Convolve with a 2D mask.
template<class ImageType, template< class > class OtherCheckPolicy>
double applyMaskWithRowAndColMirroring (const GenImage< ImageType, OtherCheckPolicy > &img, const DMask2d &mask, int imgRow, int imgCol)
 Compute the convolution of an image and a mask for a given pixel using row and column mirroring.
template<class ImageType, template< class > class OtherCheckPolicy>
double applyMaskWithRowMirroring (const GenImage< ImageType, OtherCheckPolicy > &img, const DMask2d mask, int imgRow, int imgCol)
 Compute the convolution of an image and a mask for a given pixel using row mirroring.
template<class ImageType, template< class > class OtherCheckPolicy>
double applyMaskWithColMirroring (const GenImage< ImageType, OtherCheckPolicy > &img, const DMask2d mask, int imgRow, int imgCol)
 Compute the convolution of an image and a mask for a given pixel using column mirroring.
template<class ImageType, template< class > class OtherCheckPolicy>
double applyMask (const GenImage< ImageType, OtherCheckPolicy > &img, const DMask2d mask, int imgRow, int imgCol)
 Compute the convolution of an image and a mask for a given pixel.

Protected Attributes

unsigned int _bytesPerPixel
 Number of bytes per pixel.
int * _pRefCnt
 Reference counter.
int _width
 Image width.
int _height
 Image height.
pointer _pPixMap
 Pointer to the pixel map, organized as consecutive rows.

Private Member Functions

Disabled
GenConvolImageoperator= (const GenConvolImage &rhs)
 Assignment operator.


Member Typedef Documentation

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
typedef const value_type* qgar::GenConvolImage< T, CheckingPolicy >::const_pointer
 

Constant pointer to qgar::GenConvolImage::value_type.

Reimplemented from qgar::GenImage< T, CheckingPolicy >.

Definition at line 137 of file GenConvolImage.H.

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
typedef const value_type& qgar::GenConvolImage< T, CheckingPolicy >::const_reference
 

Constant reference to qgar::GenConvolImage::value_type.

Reimplemented from qgar::GenImage< T, CheckingPolicy >.

Definition at line 127 of file GenConvolImage.H.

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
typedef value_type* qgar::GenConvolImage< T, CheckingPolicy >::pointer
 

Pointer to qgar::GenConvolImage::value_type.

Reimplemented from qgar::GenImage< T, CheckingPolicy >.

Definition at line 132 of file GenConvolImage.H.

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
typedef value_type& qgar::GenConvolImage< T, CheckingPolicy >::reference
 

Reference to qgar::GenConvolImage::value_type.

Reimplemented from qgar::GenImage< T, CheckingPolicy >.

Definition at line 122 of file GenConvolImage.H.

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
typedef T qgar::GenConvolImage< T, CheckingPolicy >::value_type
 

Type of the elements stored in the pixmap.

Reimplemented from qgar::GenImage< T, CheckingPolicy >.

Definition at line 117 of file GenConvolImage.H.


Constructor & Destructor Documentation

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy, class MaskType>
qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const GenMask1d< MaskType > &  aMask,
QGEaxis  anAxis
 

Convolution of an image and a 1D mask.

Parameters:
anImg The image to be convolved
aMask The convolution mask
anAxis The axis (default qgar::QGE_AXIS_X)

Definition at line 64 of file GenConvolImage.TCC.

References qgar::QGE_AXIS_X, qgar::GenConvolImage< T, CheckingPolicy >::xconvol(), and qgar::GenConvolImage< T, CheckingPolicy >::yconvol().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy>
qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const GenMask1d< double > &  aMask,
QGEaxis  anAxis
 

Convolution of an image and a 1D mask.

Specialization of the general template constructor.

Parameters:
anImg The image to be convolved
aMask The convolution mask
anAxis The axis (default qgar::QGE_AXIS_X)

Definition at line 97 of file GenConvolImage.TCC.

References qgar::QGE_AXIS_X, qgar::GenConvolImage< T, CheckingPolicy >::xconvol(), and qgar::GenConvolImage< T, CheckingPolicy >::yconvol().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy>
qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const GenMask2d< MaskType > &  aMask
 

Convolution of an image and a 2D mask.

Specialization of the general template constructor.

Parameters:
anImg The image to be convolved
aMask The convolution mask

Definition at line 126 of file GenConvolImage.TCC.

References qgar::GenConvolImage< T, CheckingPolicy >::convol().

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
template<class ImageType, template< class > class ImageCheckPolicy>
qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const GenMask2d< double > &  aMask
 

Convolution of an image and a 2D mask.

Specialization of the general template constructor.

Parameters:
anImg The image to be convolved
aMask The convolution mask

template<class T, template< class > class CheckingPolicy>
qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage const GenConvolImage< T, CheckingPolicy > &  other  ) 
 

Copy constructor.

Parameters:
other another instance of the class

Definition at line 165 of file GenConvolImage.TCC.

template<class T, template< class > class CheckingPolicy>
qgar::GenConvolImage< T, CheckingPolicy >::~GenConvolImage  )  [virtual]
 

Virtual destructor.

Definition at line 180 of file GenConvolImage.TCC.


Member Function Documentation

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class OtherCheckPolicy>
double qgar::GenConvolImage< T, CheckingPolicy >::applyMask const GenImage< ImageType, OtherCheckPolicy > &  img,
const DMask2d  mask,
int  imgRow,
int  imgCol
[protected]
 

Compute the convolution of an image and a mask for a given pixel.

Parameters:
img The image to be convolved
mask The mask to perform the convolution with
imgRow The row index of the point to apply the mask
imgCol The column index of the point to apply the mask

Definition at line 455 of file GenConvolImage.TCC.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class OtherCheckPolicy>
double qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithColMirroring const GenImage< ImageType, OtherCheckPolicy > &  img,
const DMask2d  mask,
int  imgRow,
int  imgCol
[protected]
 

Compute the convolution of an image and a mask for a given pixel using column mirroring.

Parameters:
img The image to be convolved
mask The mask to perform the convolution with
imgRow The row index of the point to apply the mask
imgCol The column index of the point to apply the mask

Definition at line 391 of file GenConvolImage.TCC.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class OtherCheckPolicy>
double qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithRowAndColMirroring const GenImage< ImageType, OtherCheckPolicy > &  img,
const DMask2d mask,
int  imgRow,
int  imgCol
[protected]
 

Compute the convolution of an image and a mask for a given pixel using row and column mirroring.

Parameters:
img The image to be convolved
mask The mask to perform the convolution with
imgRow The row index of the point to apply the mask
imgCol The column index of the point to apply the mask

Definition at line 359 of file GenConvolImage.TCC.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class OtherCheckPolicy>
double qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithRowMirroring const GenImage< ImageType, OtherCheckPolicy > &  img,
const DMask2d  mask,
int  imgRow,
int  imgCol
[protected]
 

Compute the convolution of an image and a mask for a given pixel using row mirroring.

Parameters:
img The image to be convolved
mask The mask to perform the convolution with
imgRow The row index of the point to apply the mask
imgCol The column index of the point to apply the mask

Definition at line 422 of file GenConvolImage.TCC.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

int qgar::GenImage< T , CheckingPolicy >::borderCols int  aColIdx  )  const [inherited]
 

Mirror border columns for convolutions.

Parameters:
aColIdx index of the column

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::xconvol().

int qgar::GenImage< T , CheckingPolicy >::borderRows int  aRowIdx  )  const [inherited]
 

Mirror border rows for convolutions.

Parameters:
aRowIdx index of the row

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::yconvol().

int qgar::GenImage< T , CheckingPolicy >::bytesPerPixel  )  const [inline, inherited]
 

Get the number of bytes per pixel.

void qgar::GenImage< T , CheckingPolicy >::column unsigned int  aColIdx,
pointer  aCol
const [inherited]
 

Get a column of pixels.

Parameters:
aColIdx column index in image
aCol buffer to store the column of pixels
Warning:
The behavior of the function is undefined if the buffer size is smaller than the column size.

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy>
void qgar::GenConvolImage< T, CheckingPolicy >::convol const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const DMask2d aMask
[protected]
 

Convolve with a 2D mask.

Parameters:
anImg image to be convolved
aMask 2D convolution mask

Definition at line 486 of file GenConvolImage.TCC.

References qgar::GenImage< T, CheckingPolicy >::_height, qgar::GenImage< T, CheckingPolicy >::_pPixMap, qgar::GenImage< T, CheckingPolicy >::_width, qgar::GenConvolImage< T, CheckingPolicy >::applyMask(), qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithColMirroring(), qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithRowAndColMirroring(), qgar::GenConvolImage< T, CheckingPolicy >::applyMaskWithRowMirroring(), qgar::GenMask2d< T >::height(), qgar::GenImage< T, CheckingPolicy >::row(), and qgar::GenMask2d< T >::width().

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage().

void qgar::GenImage< T , CheckingPolicy >::copyBox const GenImage< value_type, CheckingPolicy > &  anImg,
unsigned int  aXTopLeft,
unsigned int  aYTopLeft,
unsigned int  aXBottomRight,
unsigned int  aYBottomRight,
value_type  aPixVal = static_cast<value_type>(0)
[protected, inherited]
 

Copy a rectangular area of the given image into the current image.

The sides of the rectangle are parallel to the coordinate axis.

Parameters:
anImg initial image
aXTopLeft X coordinate of the area top left corner
aYTopLeft Y coordinate of the area left corner
aXBottomRight X coordinate of the area bottom right corner
aYBottomRight Y coordinate of the area bottom right corner
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.
Todo:
To be reimplemented.

void qgar::GenImage< T , CheckingPolicy >::draw const Segment aSeg,
value_type  aPixVal = (value_type)1
[inherited]
 

Draw a segment in the pixel map.

The segment pixels are set using Bresenham's algorithm. See W.M. Newman and R.F. Sproull, Principles of Interactive Computer Graphics, pp. 25-26.

Parameters:
aSeg segment to be drawn
aPixVal value to set pixels with (default (T)1)

qgar::GenImage< T , CheckingPolicy >::GenImage unsigned int  aBytesCnt,
int *  aPtRefCnt,
unsigned int  aWidth,
unsigned int  aHeight,
pointer  aPtPixMap
[protected, inherited]
 

Initialize from all data.

Parameters:
aBytesCnt bytes per pixel
aPtRefCnt pointer to a reference counter
aWidth width of the image
aHeight height of the image
aPtPixMap pointer to a pixel map
Warning:
Using this constructor may lead to serious bugs due to dynamic memory space management. Be sure that the value of the given reference counter (pointed by aPtRefCnt) is correct: If the given pixel map (pointed by aPtPixMap) is not shared by another object, this value must be 0. Otherwise, one must add 1 to the value, before using the constructor:
(*_pRefCnt)++;

qgar::GenImage< T , CheckingPolicy >::GenImage AbstractPbmPlusFile aPbmPlusFile  )  [explicit, inherited]
 

Initialize with an image in a PBM+ file.

The given PBM+ file is opened (in READ ONLY mode) at the call, and closed before returning.

Parameters:
aPbmPlusFile a PBM+ file containing an image
Warning:
This kind of conversion must be explicitely specified by the client.
Todo:
Constructor qgar::GenImage::GenImage(AbstractPbmPlusFile&) should just work when T is instantiated by an unsigned char because function qgar::AbstractPbmPlusFile::readRow only works with rows of unsigned integers whereas the first argument of function qgar::GenImage::setRow is a pointer to a row of type T!

qgar::GenImage< T , CheckingPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg,
unsigned int  aXTopLeft,
unsigned int  aYTopLeft,
unsigned int  aXBottomRight,
unsigned int  aYBottomRight,
value_type  aPixVal = static_cast<value_type>(0)
[inherited]
 

Initialize by copying a rectangular area, defined by the coordinates of its top left and bottom right corners, of a given image.

The rectangle sides are parallel to the coordinate axis.

Parameters:
anImg initial image
aXTopLeft X coordinate of the area top left corner
aYTopLeft Y coordinate of the area top left corner
aXBottomRight X coordinate of the area bottom right corner
aYBottomRight Y coordinate of the area bottom right corner
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.

qgar::GenImage< T , CheckingPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg,
const BoundingBox aBox,
value_type  aPixVal = static_cast<value_type>(0)
[inherited]
 

Initialize by copying a rectangular area, defined by a bounding box, of a given image.

The rectangle sides are parallel to the coordinate axis.

Parameters:
anImg initial image
aBox box defining the rectangular area to copy
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.

qgar::GenImage< T , CheckingPolicy >::GenImage const GenImage< U, UCheckPolicy > &  anImg  )  [explicit, inherited]
 

Initialize from an image with pixels of a type different from T.

Parameters:
anImg an image with pixels of type U (different from T)
Warning:
Perform a deep copy: The pixel map of the source image is duplicated. This kind of conversion must be explicitely specified by the client.

qgar::GenImage< T , CheckingPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg  )  [inherited]
 

Conversion of an image of the same type, using policies.

Parameters:
anImg an image with the same pixel type having different policies

qgar::GenImage< T , CheckingPolicy >::GenImage const GenImage< T, CheckingPolicy > &  anImg  )  [inherited]
 

Copy constructor.

Perform a deep copy: The pixel map of the source image is duplicated.

Parameters:
anImg image to be copied
See also:
qgar::GenImage::operator= and qgar::GenImage::shallowCopy

qgar::GenImage< T , CheckingPolicy >::GenImage unsigned int  aWidth,
unsigned int  aHeight,
pointer  aPtPixMap
throw (QgarErrorInvalidArg) [inherited]
 

Initialize from a pixmap.

Parameters:
aWidth width of the image (in pixels)
aHeight height of the image (in pixels)
aPtPixMap pointer to a pixel map
Warning:
This constructor takes the ownership of the given pixmap. The created instance will be responsible for deleting it.
Exceptions:
qgar::QgarErrorInvalidArg (pixel map not allocated)

qgar::GenImage< T , CheckingPolicy >::GenImage unsigned int  aWidth,
unsigned int  aHeight
[inherited]
 

Initialize with given width and height.

Parameters:
aWidth width of the image (in pixels)
aHeight height of the image (in pixels)
Warning:
The pixel map is allocated but is not initialized.

qgar::GenImage< T , CheckingPolicy >::GenImage  )  [inherited]
 

Default constructor.

Set 0 to width, to height, to pointer to pixel map, and to reference counter.

int qgar::GenImage< T , CheckingPolicy >::height  )  const [inline, inherited]
 

Get the image height.

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::minus const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Subtract each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.

Returns:
A new image constructed from this new pixel map
Parameters:
anImg image to be subtracted to the current image
Warning:
Given and current images must have the same width and height. The subtraction is not normalized: Each result is stored in the new pixel map without any checking.

GenImage& qgar::GenImage< T , CheckingPolicy >::minusEqual const GenImage< value_type, OtherCheckPolicy > &  anImg  )  throw (QgarErrorDomain) [inherited]
 

Subtract a given image to the current image.

Parameters:
anImg image to be subtracted to the current image
Subtract each pixel of the given image to the corresponding pixel of the current image and store each result in the pixel map of the current image.

Warning:
Given and current images must have the same width and height. The subtraction is not normalized: Each result is stored in the pixel map of the current image without any checking.
Exceptions:
qgar::QgarErrorDomain (image sizes do not match)

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::operator * const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Same as function qgar::GenImage::times.

GenImage& qgar::GenImage< T , CheckingPolicy >::operator *= const GenImage< value_type, OtherCheckPolicy > &  anImg  )  [inherited]
 

Same as function qgar::GenImage::timesEqual.

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::operator+ const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Same as function qgar::GenImage::plus.

GenImage& qgar::GenImage< T , CheckingPolicy >::operator+= const GenImage< value_type, OtherCheckPolicy > &  anImg  )  [inherited]
 

Same as function qgar::GenImage::plusEqual.

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::operator- const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Same as function qgar::GenImage::minus.

GenImage& qgar::GenImage< T , CheckingPolicy >::operator-= const GenImage< value_type, OtherCheckPolicy > &  anImg  )  [inherited]
 

Same as function qgar::GenImage::minusEqual.

template<class T, template< class > class CheckingPolicy = GenImage_NoCheck>
GenConvolImage& qgar::GenConvolImage< T, CheckingPolicy >::operator= const GenConvolImage< T, CheckingPolicy > &  rhs  )  [private]
 

Assignment operator.

Parameters:
rhs an instance of the class

pointer qgar::GenImage< T , CheckingPolicy >::pColumn unsigned int  aColIdx  )  const [inline, inherited]
 

Get a pointer on a column of pixels.

Parameters:
aColIdx column index in image

value_type qgar::GenImage< T , CheckingPolicy >::pixel unsigned int  aX,
unsigned int  aY
const [inherited]
 

Get a pixel value.

Parameters:
aX X coordinate (column index) of the pixel
aY Y coordinate (row index) of the pixel

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::plus const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Add each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.

Parameters:
anImg image to be added to the current image
Returns:
A new image constructed from this new pixel map
Warning:
Given and current images must have the same width and height. The addition is not normalized: Each result is stored in the new pixel map without any checking.

GenImage& qgar::GenImage< T , CheckingPolicy >::plusEqual const GenImage< value_type, OtherCheckPolicy > &  anImg  )  throw (QgarErrorDomain) [inherited]
 

Add a given image to the current image.

Add each pixel of the given image to the corresponding pixel of the current image and store each result in the pixel map of the current image.

Parameters:
anImg image to be added to the current image
Warning:
Given and current images must have the same width and height. The addition is not normalized: Each result is stored in the pixel map of the current image without any checking.
Exceptions:
qgar::QgarErrorDomain (image sizes do not match)

pointer qgar::GenImage< T , CheckingPolicy >::pPixel unsigned int  aRowIdx,
unsigned int  aColIdx
const [inline, inherited]
 

Get a pointer on a given pixel of the image.

Parameters:
aRowIdx row index of the pixel
aColIdx column index of the pixel

pointer qgar::GenImage< T , CheckingPolicy >::pPixMap  )  const [inline, inherited]
 

Get the pointer to the pixel map.

pointer qgar::GenImage< T , CheckingPolicy >::pRow unsigned int  aRowIdx  )  const [inline, inherited]
 

Get a pointer on a row of pixels.

Parameters:
aRowIdx row index in image

void qgar::GenImage< T , CheckingPolicy >::row unsigned int  aRowIdx,
pointer  aRow
const [inherited]
 

Get a row of pixels.

Parameters:
aRowIdx row index in image
aRow buffer to store the row of pixels
Warning:
The behavior of the function is undefined if the buffer size is smaller than the row size.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol().

void qgar::GenImage< T , CheckingPolicy >::save AbstractPbmPlusFile aPbmPlusFile  )  const [inherited]
 

Store current image into a PBM+ file.

The given PBM+ file is opened (in WRITE ONLY mode) at the call, and closed before returning.

Parameters:
aPbmPlusFile a PBM+ file

void qgar::GenImage< T , CheckingPolicy >::setColumn unsigned int  aColIdx,
const_pointer const   aCol
[inherited]
 

Set a given column of pixels.

Parameters:
aColIdx column index in image
aCol column of pixels to store into the pixel map

void qgar::GenImage< T , CheckingPolicy >::setPixel unsigned int  aX,
unsigned int  aY,
value_type  aPixVal
[inherited]
 

Set a pixel value.

Parameters:
aX X coordinate (column index) of the pixel
aY Y coordinate (row index) of the pixel
aPixVal value of the pixel

void qgar::GenImage< T , CheckingPolicy >::setRow unsigned int  aRowIdx,
const_pointer const   aRow
[inherited]
 

Set a given row of pixels.

Parameters:
aRowIdx row index in image
aRow row of pixels to store into the pixel map

GenImage qgar::GenImage< T , CheckingPolicy >::shallowCopy  )  [inherited]
 

Shallow copy: The pixel map of the current image is not duplicated.

See also:
qgar::GenImage::operator= and copy constructor.
Warning:
When the copy is completed, the pixel map of the new image is the same memory space as the pixel map of the current image.

GenImage<value_type, GenImage_NoCheck> qgar::GenImage< T , CheckingPolicy >::times const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const [inherited]
 

Multiply each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.

Parameters:
anImg image to be multiplied by the current image
Returns:
A new image constructed from this new pixel map
Warning:
Given and current images must have the same width and height. The multiplication is not normalized: Each result is stored in the new pixel map without any checking.

GenImage& qgar::GenImage< T , CheckingPolicy >::timesEqual const GenImage< value_type, OtherCheckPolicy > &  anImg  )  throw (QgarErrorDomain) [inherited]
 

Multiply a given image by the current image.

Multiply each pixel of the given image by the corresponding pixel of the current image and store each result in the pixel map of the current image.

Parameters:
anImg image to be multiplied by the current image
Warning:
Given and current images must have the same width and height. The multiplication is not normalized: Each result is stored in the pixel map of the current image without any checking.
Exceptions:
qgar::QgarErrorDomain (image sizes do not match)

int qgar::GenImage< T , CheckingPolicy >::width  )  const [inline, inherited]
 

Get the image width.

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy>
void qgar::GenConvolImage< T, CheckingPolicy >::xconvol const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const DMask1d aMask
[protected]
 

Convolve and image along X axis with a 1D mask.

Parameters:
anImg image to be convolved
aMask 1D convolution mask

Definition at line 200 of file GenConvolImage.TCC.

References qgar::GenImage< T, CheckingPolicy >::_height, qgar::GenImage< T, CheckingPolicy >::_pPixMap, qgar::GenImage< T, CheckingPolicy >::_width, qgar::GenImage< T, CheckingPolicy >::borderCols(), qgar::GenMask1d< T >::pCoeffMap(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenMask1d< T >::width().

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage().

template<class T, template< class > class CheckingPolicy>
template<class ImageType, template< class > class ImageCheckPolicy>
void qgar::GenConvolImage< T, CheckingPolicy >::yconvol const GenImage< ImageType, ImageCheckPolicy > &  anImg,
const DMask1d aMask
[protected]
 

Convolve along Y axis with a 1D mask.

Parameters:
anImg image to be convolved
aMask 1D convolution mask

Definition at line 277 of file GenConvolImage.TCC.

References qgar::GenImage< T, CheckingPolicy >::_height, qgar::GenImage< T, CheckingPolicy >::_pPixMap, qgar::GenImage< T, CheckingPolicy >::_width, qgar::GenImage< T, CheckingPolicy >::borderRows(), qgar::GenMask1d< T >::pCoeffMap(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenMask1d< T >::width().

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::GenConvolImage().


Member Data Documentation

unsigned int qgar::GenImage< T , CheckingPolicy >::_bytesPerPixel [protected, inherited]
 

Number of bytes per pixel.

Definition at line 1096 of file GenImage.H.

int qgar::GenImage< T , CheckingPolicy >::_height [protected, inherited]
 

Image height.

Definition at line 1114 of file GenImage.H.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol(), qgar::GenConvolImage< T, CheckingPolicy >::xconvol(), and qgar::GenConvolImage< T, CheckingPolicy >::yconvol().

pointer qgar::GenImage< T , CheckingPolicy >::_pPixMap [protected, inherited]
 

Pointer to the pixel map, organized as consecutive rows.

Definition at line 1120 of file GenImage.H.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol(), qgar::GenConvolImage< T, CheckingPolicy >::xconvol(), and qgar::GenConvolImage< T, CheckingPolicy >::yconvol().

int* qgar::GenImage< T , CheckingPolicy >::_pRefCnt [protected, inherited]
 

Reference counter.

Its value represent the number of other images with which the current image shares its pixel map.

Definition at line 1104 of file GenImage.H.

int qgar::GenImage< T , CheckingPolicy >::_width [protected, inherited]
 

Image width.

Definition at line 1109 of file GenImage.H.

Referenced by qgar::GenConvolImage< T, CheckingPolicy >::convol(), qgar::GenConvolImage< T, CheckingPolicy >::xconvol(), and qgar::GenConvolImage< T, CheckingPolicy >::yconvol().


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