#include <qgarlib/GenImage.H>
Inheritance diagram for qgar::GenImage< T, CheckPolicy >:

O
+----------------> X
|
|
|
V
Y
Predefined types:
The implementation code uses some of Scott Meyers' tips from [Meyer, 1996]. See especially item #20, pages 101-104, about the return value optimization (RVO).
Definition at line 384 of file GenImage.H.
Public Types | |
Types | |
| typedef T | value_type |
| Type of the elements stored in the pixel map. | |
| typedef value_type & | reference |
| Reference to qgar::GenImage::value_type. | |
| typedef const value_type & | const_reference |
| Constant reference to qgar::GenImage::value_type. | |
| typedef value_type * | pointer |
| Pointer to qgar::GenImage::value_type. | |
| typedef const value_type * | const_pointer |
| Constant pointer to qgar::GenImage::value_type. | |
Public Member Functions | |
| template<class T, template< class > class CheckPolicy> | |
| GenImage (unsigned int aWidth, unsigned int aHeight, T *aPtPixMap) throw (QgarErrorInvalidArg) | |
| template<class T, template< class > class CheckPolicy> | |
| GenImage (unsigned int aBytesCnt, int *aPtRefCnt, unsigned int aWidth, unsigned int aHeight, T *aPtPixMap) | |
Constructors | |
| GenImage () | |
| Default constructor. | |
| GenImage (unsigned int aWidth, unsigned int aHeight) | |
| Initialize with given width and height. | |
Constructor from raw data | |
| GenImage (unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap) throw (QgarErrorInvalidArg) | |
| Initialize from a pixmap. | |
Constructors from images | |
| GenImage (const GenImage &anImg) | |
| Copy constructor. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg) | |
| Conversion of an image of the same type, using policies. | |
| template<class U, template< class > class UCheckPolicy> | |
| GenImage (const GenImage< U, UCheckPolicy > &anImg) | |
| Initialize from an image with pixels of a type different from T. | |
| template<template< class > class OtherCheckPolicy> | |
| 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. | |
| template<template< class > class OtherCheckPolicy> | |
| 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. | |
Constructors from image files | |
| GenImage (AbstractPbmPlusFile &aPbmPlusFile) | |
| Initialize with an image in a PBM+ file. | |
Destructor | |
| virtual | ~GenImage () |
| Free space allocated to the pixel map if and only if the reference counter is null. | |
Access to image characteristics | |
| int | width () const |
| Get the image width. | |
| int | height () const |
| Get the image height. | |
| int | bytesPerPixel () const |
| Get the number of bytes per pixel. | |
Access to pixel values | |
| 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. | |
Access to direct transformations of the pixel map | |
| 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. | |
Set pixel values | |
| 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. | |
Draw in the pixel map | |
| void | draw (const Segment &aSeg, value_type aPixVal=(value_type) 1) |
| Draw a segment in the pixel map. | |
Copy | |
| GenImage | shallowCopy () |
| Shallow copy: The pixel map of the current image is not duplicated. | |
Operators | |
| |
| GenImage & | operator= (const GenImage &anImg) |
| Assign given image to current image. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | operator= (const GenImage< value_type, OtherCheckPolicy > &anImg) |
| Assign given image to current image. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | operator+ (const GenImage< value_type, OtherCheckPolicy > &anImg) const |
| Same as function qgar::GenImage::plus. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | operator+= (const GenImage< value_type, OtherCheckPolicy > &anImg) |
| Same as function qgar::GenImage::plusEqual. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | operator- (const GenImage< value_type, OtherCheckPolicy > &anImg) const |
| Same as function qgar::GenImage::minus. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | operator-= (const GenImage< value_type, OtherCheckPolicy > &anImg) |
| Same as function qgar::GenImage::minusEqual. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | operator * (const GenImage< value_type, OtherCheckPolicy > &anImg) const |
| Same as function qgar::GenImage::times. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | operator *= (const GenImage< value_type, OtherCheckPolicy > &anImg) |
| Same as function qgar::GenImage::timesEqual. | |
Functional operators | |
| |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | plus (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. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | plusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain) |
| Add a given image to the current image. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | minus (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. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | minusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain) |
| Subtract a given image to the current image. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage< value_type, GenImage_NoCheck > | times (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. | |
| template<template< class > class OtherCheckPolicy> | |
| GenImage & | timesEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain) |
| Multiply a given image by the current image. | |
File storage | |
| void | save (AbstractPbmPlusFile &aPbmPlusFile) const |
| Store current image into a PBM+ file. | |
Border mirroring | |
| int | borderRows (int aRowIdx) const |
| Mirror border rows for convolutions. | |
| int | borderCols (int aColIdx) const |
| Mirror border columns for convolutions. | |
Protected Member Functions | |
Constructor from raw data | |
| GenImage (unsigned int aBytesCnt, int *aPtRefCnt, unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap) | |
| Initialize from all data. | |
Auxiliaries | |
| void | copyBox (const GenImage< value_type, CheckPolicy > &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. | |
Protected Attributes | |
Representation of an image | |
| 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. | |
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||
|
|||||||||
|
Default constructor. Set 0 to width, to height, to pointer to pixel map, and to reference counter. Definition at line 60 of file GenImage.TCC. Referenced by qgar::GenImage< T, CheckPolicy >::minus(), qgar::GenImage< T, CheckPolicy >::plus(), and qgar::GenImage< T, CheckPolicy >::times(). |
|
||||||||||||||||
|
Initialize with given width and height.
Definition at line 77 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap. |
|
||||||||||||||||||||
|
Initialize from a pixmap.
|
|
||||||||||
|
Copy constructor. Perform a deep copy: The pixel map of the source image is duplicated.
Definition at line 153 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. |
|
||||||||||||||
|
Conversion of an image of the same type, using policies.
Definition at line 172 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, and qgar::GenImage< T, CheckPolicy >::pPixMap(). |
|
||||||||||||||
|
Initialize from an image with pixels of a type different from T.
|
|
||||||||||||||||||||||||
|
Initialize by copying a rectangular area, defined by a bounding box, of a given image. The rectangle sides are parallel to the coordinate axis.
Definition at line 226 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, qgar::GenImage< T, CheckPolicy >::copyBox(), qgar::BoundingBox::xBottomRight(), qgar::BoundingBox::xTopLeft(), qgar::BoundingBox::yBottomRight(), and qgar::BoundingBox::yTopLeft(). |
|
||||||||||||||||||||||||||||||||||||
|
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.
Definition at line 258 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, and qgar::GenImage< T, CheckPolicy >::copyBox(). |
|
||||||||||
|
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.
Definition at line 295 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, qgar::AbstractFile::close(), qgar::AbstractPbmPlusFile::colCnt(), qgar::AbstractFile::openRONLY(), qgar::AbstractPbmPlusFile::pRow(), qgar::AbstractPbmPlusFile::readRow(), qgar::AbstractPbmPlusFile::rowCnt(), and qgar::GenImage< T, CheckPolicy >::setRow(). |
|
|||||||||
|
Free space allocated to the pixel map if and only if the reference counter is null.
Definition at line 323 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_pRefCnt. |
|
||||||||||||||||||||||||||||
|
Initialize from all data.
|
|
||||||||||||||||||||||||
|
Definition at line 98 of file GenImage.TCC. |
|
||||||||||||||||||||||||||||||||
|
Definition at line 127 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. |
|
||||||||||
|
Mirror border columns for convolutions.
Definition at line 1052 of file GenImage.TCC. |
|
||||||||||
|
Mirror border rows for convolutions.
Definition at line 1036 of file GenImage.TCC. |
|
|||||||||
|
Get the number of bytes per pixel.
Definition at line 369 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_bytesPerPixel. |
|
||||||||||||||||
|
Get a column of pixels.
|
|
||||||||||||||||||||||||||||||||
|
Copy a rectangular area of the given image into the current image. The sides of the rectangle are parallel to the coordinate axis.
Definition at line 1074 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), qgar::qgFill(), and qgar::GenImage< T, CheckPolicy >::width(). Referenced by qgar::GenImage< T, CheckPolicy >::GenImage(). |
|
||||||||||||||||
|
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.
Definition at line 535 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::setPixel(), qgar::AbstractGenPrimitive< T >::source(), qgar::AbstractGenPrimitive< T >::target(), qgar::GenPoint< T >::x(), and qgar::GenPoint< T >::y(). |
|
|||||||||
|
||||||||||||||
|
Subtract each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
Definition at line 867 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::GenImage(). Referenced by qgar::GenImage< T, CheckPolicy >::operator-(). |
|
||||||||||||||
|
Subtract a given image to the current image.
Definition at line 877 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenImage< T, CheckPolicy >::width(). Referenced by qgar::GenImage< T, CheckPolicy >::operator-=(). |
|
||||||||||||||
|
Same as function qgar::GenImage::times.
Definition at line 926 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::times(). |
|
||||||||||||||
|
Same as function qgar::GenImage::timesEqual.
Definition at line 937 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::timesEqual(). |
|
||||||||||||||
|
Same as function qgar::GenImage::plus.
Definition at line 767 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::plus(). |
|
||||||||||||||
|
Same as function qgar::GenImage::plusEqual.
Definition at line 778 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::plusEqual(). |
|
||||||||||||||
|
Same as function qgar::GenImage::minus.
Definition at line 846 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::minus(). |
|
||||||||||||||
|
Same as function qgar::GenImage::minusEqual.
Definition at line 857 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::minusEqual(). |
|
||||||||||||||
|
Assign given image to current image. The current image is not supposed to initially have the same dimensions as the given image.
Definition at line 736 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenImage< T, CheckPolicy >::width(). |
|
||||||||||
|
Assign given image to current image. The current image must have the same dimensions as the given image. The pixel map of the given image is copied into the pixel map of the current image.
Definition at line 712 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenImage< T, CheckPolicy >::width(). |
|
||||||||||
|
Get a pointer on a column of pixels.
Definition at line 453 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap. |
|
||||||||||||||||
|
Get a pixel value.
Definition at line 384 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. Referenced by qgar::AbstractGradientImage::dxPixel(), qgar::AbstractGradientImage::dyPixel(), qgar::PruneSmallCCBinaryImage::isNeighbor(), qgar::MapleFile::MapleFile(), and qgar::PruneSmallCCBinaryImage::PruneSmallCCBinaryImage(). |
|
||||||||||||||
|
Add each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
Definition at line 788 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::GenImage(). Referenced by qgar::GenImage< T, CheckPolicy >::operator+(). |
|
||||||||||||||
|
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.
Definition at line 797 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenImage< T, CheckPolicy >::width(). Referenced by qgar::GenImage< T, CheckPolicy >::operator+=(). |
|
||||||||||||||||
|
Get a pointer on a given pixel of the image.
Definition at line 432 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. |
|
|||||||||
|
||||||||||
|
Get a pointer on a row of pixels.
Definition at line 443 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. |
|
||||||||||||||||
|
Get a row of pixels.
Referenced by qgar::CleanedBinaryImage::CleanedBinaryImage(), qgar::LinDilatedImage::dilateAll(), qgar::LinDilatedBinaryImage::dilateAll(), qgar::LinErodedImage::erodeAll(), qgar::LinErodedBinaryImage::erodeAll(), qgar::IsotropicDilatedBinaryImage::IsotropicDilatedBinaryImage(), qgar::NiblackBinaryImage::NiblackBinaryImage(), and qgar::GenImage< T, CheckPolicy >::save(). |
|
||||||||||
|
Store current image into a PBM+ file. The given PBM+ file is opened (in WRITE ONLY mode) at the call, and closed before returning.
Definition at line 1005 of file GenImage.TCC. References qgar::AbstractFile::close(), qgar::AbstractFile::openWONLY(), qgar::AbstractPbmPlusFile::pRow(), qgar::GenImage< T, CheckPolicy >::row(), qgar::AbstractPbmPlusFile::setColCnt(), qgar::AbstractPbmPlusFile::setRowCnt(), and qgar::AbstractPbmPlusFile::writeRow(). |
|
||||||||||||||||
|
Set a given column of pixels.
|
|
||||||||||||||||||||
|
Set a pixel value.
Definition at line 478 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width. Referenced by qgar::GenImage< T, CheckPolicy >::draw(), and qgar::PruneSmallCCBinaryImage::removeComponent(). |
|
||||||||||||||||
|
Set a given row of pixels.
Referenced by qgar::CleanedBinaryImage::CleanedBinaryImage(), qgar::LinDilatedImage::dilateAll(), qgar::LinDilatedBinaryImage::dilateAll(), qgar::LinErodedImage::erodeAll(), qgar::LinErodedBinaryImage::erodeAll(), qgar::GenImage< T, CheckPolicy >::GenImage(), qgar::IsotropicDilatedBinaryImage::IsotropicDilatedBinaryImage(), and qgar::NiblackBinaryImage::NiblackBinaryImage(). |
|
|||||||||
|
Shallow copy: The pixel map of the current image is not duplicated.
Definition at line 691 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::_bytesPerPixel, qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_pRefCnt. Referenced by qgar::AbstractGradientImage::shallowCopy(). |
|
||||||||||||||
|
Multiply each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
Definition at line 947 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::GenImage(). Referenced by qgar::GenImage< T, CheckPolicy >::operator *(). |
|
||||||||||||||
|
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.
Definition at line 958 of file GenImage.TCC. References qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), and qgar::GenImage< T, CheckPolicy >::width(). Referenced by qgar::GenImage< T, CheckPolicy >::operator *=(). |
|
|||||||||
|
|||||
|
Number of bytes per pixel.
Definition at line 1096 of file GenImage.H. Referenced by qgar::GenImage< T, CheckPolicy >::bytesPerPixel(), and qgar::GenImage< T, CheckPolicy >::shallowCopy(). |
|
|||||
|
|||||
|
|||||
|
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. Referenced by qgar::GenImage< T, CheckPolicy >::shallowCopy(), and qgar::GenImage< T, CheckPolicy >::~GenImage(). |
|
|||||