ViSP  2.10.0

#include <vpImage.h>

Public Member Functions

 vpImage ()
 
 vpImage (const vpImage< Type > &)
 
 vpImage (unsigned int height, unsigned int width)
 
 vpImage (unsigned int height, unsigned int width, Type value)
 
virtual ~vpImage ()
 
void init (unsigned int height, unsigned int width)
 
void init (unsigned int height, unsigned int width, Type value)
 
void resize (const unsigned int h, const unsigned int w)
 
void resize (const unsigned int h, const unsigned int w, const Type val)
 
void destroy ()
 
unsigned int getHeight () const
 
unsigned int getWidth () const
 
unsigned int getRows () const
 
unsigned int getCols () const
 
unsigned int getSize () const
 
Type getMaxValue () const
 
Type getMinValue () const
 
void getMinMaxValue (Type &min, Type &max) const
 
Type getValue (double i, double j) const
 
Type getValue (vpImagePoint &ip) const
 
unsigned int getNumberOfPixel () const
 
Type * operator[] (const unsigned int i)
 
Type * operator[] (const int i)
 
const Type * operator[] (unsigned int i) const
 
const Type * operator[] (int i) const
 
Type operator() (const unsigned int i, const unsigned int j) const
 
void operator() (const unsigned int i, const unsigned int j, const Type &v)
 
Type operator() (const vpImagePoint &ip) const
 
void operator() (const vpImagePoint &ip, const Type &v)
 
vpImage< Type > operator- (const vpImage< Type > &B)
 
vpImage< Type > & operator= (const vpImage< Type > &I)
 
vpImage< Type > & operator= (const Type &v)
 
bool operator== (const vpImage< Type > &I)
 
bool operator!= (const vpImage< Type > &I)
 
void insert (const vpImage< Type > &src, const vpImagePoint topLeft)
 
void halfSizeImage (vpImage< Type > &res)
 
void quarterSizeImage (vpImage< Type > &res)
 
void doubleSizeImage (vpImage< Type > &res)
 
void sub (const vpImage< Type > &B, vpImage< Type > &C)
 
void sub (const vpImage< Type > &A, const vpImage< Type > &B, vpImage< Type > &C)
 

Public Attributes

Type * bitmap
 
vpDisplaydisplay
 

Friends

class vpImageConvert
 

Deprecated functions

vp_deprecated void sub (vpImage< Type > *im2, vpImage< Type > *dst)
 
vp_deprecated void halfSizeImage (vpImage< Type > *res)
 
vp_deprecated void quarterSizeImage (vpImage< Type > *res)
 
vp_deprecated void doubleSizeImage (vpImage< Type > *res)
 

Detailed Description

template<class Type>
class vpImage< Type >

Definition of the vpImage class member functions.

This is a template class, therefore the type of each element of the array is not a priori defined.

Data structure

Each image is build using two structure (an array bitmap which size is [width*height]) and an array of pointer row (which size is [nrow]) the ith element in the row array row[i] is pointer toward the ith "line" of the image (ie, bitmap +i*width )

image-data-structure.gif

Such a structure allows a fast acces to each element of the image. if i is the ith rows and j the jth columns the value of this pixel is given by I[i][j] (that is equivalent to row[i][j]).

Example

The following example available in tutorial-image-manipulation.cpp shows how to create gray level and color images and how to access to the pixels.

#include <visp/vpImage.h>
int main()
{
try {
vpImage<unsigned char> gray_image(240, 320);
vpImage<vpRGBa> color_image(240, 320);
gray_image = 128;
vpRGBa color(255, 0, 0);
color_image = color;
unsigned int igray_max = gray_image.getHeight() - 1;
unsigned int jgray_max = gray_image.getWidth() - 1;
std::cout << "Gray image, last pixel intensity: "
<< (int)gray_image[igray_max][jgray_max] << std::endl;
unsigned int icolor_max = color_image.getHeight() - 1;
unsigned int jcolor_max = color_image.getWidth() - 1;
std::cout << "Color image, last pixel RGB components: "
<< (int)color_image[icolor_max][jcolor_max].R << " "
<< (int)color_image[icolor_max][jcolor_max].G << " "
<< (int)color_image[icolor_max][jcolor_max].B
<< std::endl;
}
catch(vpException e) {
std::cout << "Catch an exception: " << e << std::endl;
}
}

Important remark

To provide high-performance access there is no verification to ensure that 0 $\le$ i < height and 0 $\le$ j < width. Since the memory allocated in the bitmap array is continuous, that means that if (i, j) is outside the image you will manipulate a pixel that is not as expected. To highlight this remark, we provide hereafter an example where the considered pixel is outside the image:

unsigned int width = 320;
unsigned int height = 240;
vpImage<unsigned char> I(height, width); // Create an 320x240 image
// Set pixel coordinates that is outside the image
unsigned int i = 100;
unsigned int j = 400;
unsigned char value;
value = I[i][j]; // Here we will get the pixel value at position (101, 80)

Definition at line 115 of file vpImage.h.

Constructor & Destructor Documentation

template<class Type >
vpImage< Type >::vpImage ( )

constructor

Constructor.

No memory allocation is done

set all the element of the bitmap to value

See also
vpImage::resize(height, width) for memory allocation

Definition at line 509 of file vpImage.h.

template<class Type>
vpImage< Type >::vpImage ( const vpImage< Type > &  I)

copy constructor

Copy constructor

Definition at line 634 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpImage< Type >::resize(), and vpERROR_TRACE.

template<class Type>
vpImage< Type >::vpImage ( unsigned int  h,
unsigned int  w 
)

constructor set the size of the image

Constructor.

Allocate memory for an [h x w] image.

Parameters
w: Image width.
h: Image height.

Element of the bitmap are set to zero.

If the image has been already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Exceptions
vpException::memoryAllocationError
See also
vpImage::init(height, width)

Definition at line 454 of file vpImage.h.

References vpImage< Type >::init().

template<class Type>
vpImage< Type >::vpImage ( unsigned int  h,
unsigned int  w,
Type  value 
)

constructor set the size of the image and init all the pixel

Constructor.

Allocate memory for an [height x width] image.

Parameters
w: Image width.
h: Image height.
value: Set all the element of the bitmap to value.

If the image has been already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Returns
MEMORY_FAULT if memory allocation is impossible, else OK
See also
vpImage::init(height, width, value)

Definition at line 485 of file vpImage.h.

References vpImage< Type >::init(), and vpERROR_TRACE.

template<class Type >
vpImage< Type >::~vpImage ( )
virtual

destructor

Destructor : Memory de-allocation.

Warning
does not deallocate memory for display and video

Definition at line 623 of file vpImage.h.

Member Function Documentation

template<class Type >
void vpImage< Type >::destroy ( )

destructor

Destructor : Memory de-allocation.

Warning
does not deallocate memory for display and video

Definition at line 592 of file vpImage.h.

Referenced by vpImageFilter::filter(), vpImageFilter::gaussianBlur(), and vpTemplateTracker::initTracking().

template<class Type>
void vpImage< Type >::doubleSizeImage ( vpImage< Type > &  res)

Returns a new image that's double size of the current image. Used (eg. in case of keypoints extraction, we might double size of the image in order to have more keypoints). The double size image is computed by nearest-neighbour interpolation:

A B C
E F G
H I J
where
A C H J are pixels from original image
B E G I are interpolated pixels
Warning
Operator = must be defined for Type.
Parameters
res[out] : Image that is double size of the current image.

The example below shows how to use this method:

vpImage<unsigned char> I; // original image
vpImageIo::read(I, "myImage.pgm");
vpImage<unsigned char> I2; // double size image
vpImageIo::write(I2, "myDoubleSizeImage.pgm");

See halfSizeImage(vpImage<Type> &) for an example of pyramid construction.

Definition at line 1017 of file vpImage.h.

References vpImage< Type >::resize().

template<class Type>
void vpImage< Type >::doubleSizeImage ( vpImage< Type > *  res)
Deprecated:
This method is deprecated. You should use doubleSizeImage(vpImage<Type> &) instead.

Returns a new image that's double size of the current image. Used (eg. in case of keypoints extraction, we might double size of the image in order to have more keypoints)

Warning
Operator = must be defined for Type.
Exceptions
vpException::memoryAllocationErrorIf images pointer is NULL or if the images size differ.

Definition at line 1558 of file vpImage.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().

template<class Type>
unsigned int vpImage< Type >::getCols ( ) const
inline

Get the number of columns in the image.

Returns
The image number of column, or image width.
See also
getWidth()

Definition at line 180 of file vpImage.h.

Referenced by vpImageConvert::convert(), vpMomentObject::fromImage(), and vpMbKltTracker::reinit().

template<class Type>
unsigned int vpImage< Type >::getHeight ( ) const
inline

Get the image height.

Returns
The image height.
See also
getWidth()

Definition at line 152 of file vpImage.h.

Referenced by vpDiskGrabber::acquire(), vp1394CMUGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vpImageTools::binarise(), vpPlanarObjectDetector::buildReference(), vpKeyPointSurf::buildReference(), vpFernClassifier::buildReference(), vpHistogram::calculate(), vpImageTools::changeLUT(), vpMbtDistanceLine::closeToImageBorder(), vpMeLine::computeRhoTheta(), vpImageConvert::convert(), vpMeSite::convolution(), vpKeyPoint::createImageMatching(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpDetectorDataMatrixCode::detect(), vpDetectorQRCode::detect(), vpImageMorphology::dilatation(), vpMbtDistanceLine::display(), vpMeLine::display(), vpMbKltTracker::display(), vpWireFrameSimulator::display_scene(), vpDisplayX::displayImage(), vpDisplayOpenCV::displayImage(), vpDisplayOpenCV::displayImageROI(), vpFeatureDisplay::displayLine(), vpKeyPoint::displayMatching(), vpDisplay::displayROI(), vpImage< Type >::doubleSizeImage(), vpImageMorphology::erosion(), vpTemplateTrackerZone::fillTriangle(), vpImageFilter::filter(), vpImageFilter::filterX(), vpImageFilter::filterY(), vpImageFilter::filterYBottomBorder(), vpImageTools::flip(), vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpAfma6::getCameraParameters(), vpSimulatorAfma6::getCameraParameters(), vpSimulatorViper850::getCameraParameters(), vpTemplateTrackerSSD::getCost(), vpTemplateTrackerZNCC::getCost(), vpKinect::getDepthMap(), vpRobotWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpImageFilter::getGaussPyramidal(), vpImageFilter::getGaussXPyramidal(), vpImageFilter::getGaussYPyramidal(), vpImageFilter::getGradX(), vpImageFilter::getGradY(), vpDisplayX::getImage(), vpImageSimulator::getImage(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpMbtPolygon::getNbCornerInsideImage(), vpAROgre::getRenderingOutput(), vpTemplateTrackerSSD::getSSD(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpDisplayWin32::init(), vpAROgre::init(), vpDisplayX::init(), vpDisplayGTK::init(), vpDisplayOpenCV::init(), vpMbKltTracker::init(), vpMbEdgeTracker::init(), vpTemplateTrackerZone::initFromPoints(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpMbtDistanceLine::initMovingEdge(), vpMbEdgeTracker::initPyramid(), vpTemplateTracker::initTracking(), vpImage< Type >::insert(), vpKeyPoint::insertImageMatching(), vpMbtPolygon::isVisible(), vpMeNurbs::localReSample(), vpPlanarObjectDetector::matchPoint(), vpKeyPointSurf::matchPoint(), vpFernClassifier::matchPoint(), vpWireFrameSimulator::navigation(), vpDiskGrabber::open(), vpVideoWriter::open(), vpVideoReader::open(), vpImage< Type >::operator!=(), vpImage< Type >::operator==(), vpImage< Type >::quarterSizeImage(), vpImageIo::readJPEG(), vpImageIo::readPFM(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpImageIo::readPPM(), vpMbKltTracker::reinit(), vpMbtPolygon::roiInsideImage(), vpMeLine::sample(), vpMeNurbs::sample(), vpDot2::searchDotsInArea(), vpMeNurbs::seekExtremities(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), vpAR::setImage(), vpFernClassifier::setImage(), vpImageConvert::split(), vpImage< Type >::sub(), vpTemplateTrackerZNCCForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerZNCCInverseCompositional::trackNoPyr(), vpTemplateTrackerSSDInverseCompositional::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpImageTools::undistort(), vpMbtDistanceLine::updateMovingEdge(), vpImage< Type >::vpImage(), vpKinect::warpRGBFrame(), vpImageIo::writeJPEG(), vpImageIo::writePFM(), vpImageIo::writePGM(), vpImageIo::writePNG(), and vpImageIo::writePPM().

template<class Type >
Type vpImage< Type >::getMaxValue ( ) const

Return the maximum value within the bitmap.

See also
getMinValue()

Definition at line 656 of file vpImage.h.

template<class Type>
void vpImage< Type >::getMinMaxValue ( Type &  min,
Type &  max 
) const

Look for the minimum and the maximum value within the bitmap.

See also
getMaxValue()
getMinValue()

Definition at line 688 of file vpImage.h.

Referenced by vpImageConvert::convert().

template<class Type >
Type vpImage< Type >::getMinValue ( ) const

Return the minimum value within the bitmap.

See also
getMaxValue()

Definition at line 672 of file vpImage.h.

template<class Type>
unsigned int vpImage< Type >::getNumberOfPixel ( ) const
inline

Get the image number of pixels which corresponds to the image width multiplied by the image height.

Returns
The image number of pixels or image size.
See also
getWidth(), getHeight()

Definition at line 214 of file vpImage.h.

Referenced by vpImageConvert::split().

template<class Type>
unsigned int vpImage< Type >::getRows ( ) const
inline

Get the number of rows in the image.

Returns
The image number of rows, or image height.
See also
getHeight()

Definition at line 171 of file vpImage.h.

Referenced by vpImageConvert::convert(), vpMomentObject::fromImage(), and vpMbKltTracker::reinit().

template<class Type>
unsigned int vpImage< Type >::getSize ( ) const
inline

Get the image size.

Returns
The image size = width * height.
See also
getWidth(), getHeight()

Definition at line 189 of file vpImage.h.

Referenced by vp1394CMUGrabber::acquire().

template<class Type >
Type vpImage< Type >::getValue ( double  i,
double  j 
) const
template<class Type >
Type vpImage< Type >::getValue ( vpImagePoint ip) const
Warning
This generic method is not implemented. You should rather use the instantiated methods for double, unsigned char and vpRGBa images.
See also
vpImage<double>::getValue(vpImagePoint &)
vpImage<unsigned char>::getValue(vpImagePoint &)
vpImage<vpRGBa>::getValue(vpImagePoint &)

Definition at line 1233 of file vpImage.h.

References vpTRACE.

template<class Type>
unsigned int vpImage< Type >::getWidth ( ) const
inline

Get the image width.

Returns
The image width.
See also
getHeight()

Definition at line 161 of file vpImage.h.

Referenced by vpDiskGrabber::acquire(), vp1394CMUGrabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vpImageTools::binarise(), vpPlanarObjectDetector::buildReference(), vpKeyPointSurf::buildReference(), vpFernClassifier::buildReference(), vpHistogram::calculate(), vpImageTools::changeLUT(), vpMbtDistanceLine::closeToImageBorder(), vpMeLine::computeRhoTheta(), vpImageConvert::convert(), vpMeSite::convolution(), vpKeyPoint::createImageMatching(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpDetectorDataMatrixCode::detect(), vpDetectorQRCode::detect(), vpImageMorphology::dilatation(), vpMbtDistanceLine::display(), vpMeLine::display(), vpMbKltTracker::display(), vpWireFrameSimulator::display_scene(), vpDisplayX::displayImage(), vpDisplayOpenCV::displayImage(), vpDisplayX::displayImageROI(), vpDisplayOpenCV::displayImageROI(), vpFeatureDisplay::displayLine(), vpKeyPoint::displayMatching(), vpDisplay::displayROI(), vpImage< Type >::doubleSizeImage(), vpImageMorphology::erosion(), vpTemplateTrackerZone::fillTriangle(), vpImageFilter::filter(), vpImageFilter::filterX(), vpImageFilter::filterXRightBorder(), vpImageFilter::filterY(), vpImageTools::flip(), vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpAfma6::getCameraParameters(), vpSimulatorAfma6::getCameraParameters(), vpSimulatorViper850::getCameraParameters(), vpTemplateTrackerSSD::getCost(), vpTemplateTrackerZNCC::getCost(), vpRobotWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpImageFilter::getGaussPyramidal(), vpImageFilter::getGaussXPyramidal(), vpImageFilter::getGaussYPyramidal(), vpImageFilter::getGradX(), vpImageFilter::getGradY(), vpDisplayX::getImage(), vpImageSimulator::getImage(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpMbtPolygon::getNbCornerInsideImage(), vpAROgre::getRenderingOutput(), vpTemplateTrackerSSD::getSSD(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpDisplayWin32::init(), vpAROgre::init(), vpDisplayX::init(), vpDisplayGTK::init(), vpDisplayOpenCV::init(), vpMbKltTracker::init(), vpMbEdgeTracker::init(), vpMbTracker::initClick(), vpTemplateTrackerZone::initFromPoints(), vpTemplateTrackerZNCCForwardAdditional::initHessienDesired(), vpTemplateTrackerZNCCInverseCompositional::initHessienDesired(), vpMbtDistanceLine::initMovingEdge(), vpMbEdgeTracker::initPyramid(), vpTemplateTracker::initTracking(), vpImage< Type >::insert(), vpKeyPoint::insertImageMatching(), vpMbtPolygon::isVisible(), vpMeNurbs::localReSample(), vpPlanarObjectDetector::matchPoint(), vpKeyPointSurf::matchPoint(), vpFernClassifier::matchPoint(), vpWireFrameSimulator::navigation(), vpDiskGrabber::open(), vpVideoWriter::open(), vpVideoReader::open(), vpImage< Type >::operator!=(), vpImage< Type >::operator==(), vpImage< Type >::quarterSizeImage(), vpImageIo::readJPEG(), vpImageIo::readPFM(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpImageIo::readPPM(), vpMbKltTracker::reinit(), vpMbtPolygon::roiInsideImage(), vpMeLine::sample(), vpMeNurbs::sample(), vpDot2::searchDotsInArea(), vpMeLine::seekExtremities(), vpMeNurbs::seekExtremities(), vpMeNurbs::seekExtremitiesCanny(), vpAR::setImage(), vpFernClassifier::setImage(), vpImageConvert::split(), vpImage< Type >::sub(), vpTemplateTrackerZNCCForwardAdditional::trackNoPyr(), vpTemplateTrackerSSDForwardCompositional::trackNoPyr(), vpTemplateTrackerSSDESM::trackNoPyr(), vpTemplateTrackerZNCCInverseCompositional::trackNoPyr(), vpTemplateTrackerSSDInverseCompositional::trackNoPyr(), vpTemplateTrackerSSDForwardAdditional::trackNoPyr(), vpImageTools::undistort(), vpMbtDistanceLine::updateMovingEdge(), vpImage< Type >::vpImage(), vpKinect::warpRGBFrame(), vpImageIo::writeJPEG(), vpImageIo::writePFM(), vpImageIo::writePGM(), vpImageIo::writePNG(), and vpImageIo::writePPM().

template<class Type>
void vpImage< Type >::halfSizeImage ( vpImage< Type > &  res)

Returns a new image that's half size of the current image. No filtering is used during the sub sampling.

Used for building pyramid of the image.

Warning
Operator = must be defined for Type.
Parameters
res[out] : Subsampled image that is half size of the current image.

The example below shows how to use this method:

vpImage<unsigned char> I; // original image
vpImageIo::read(I, "myImage.pgm");
vpImage<unsigned char> I2; // half size image
vpImageIo::write(I2, "myHalfSizeImage.pgm");

This other example shows how to construct a pyramid of the image:

vpImage<unsigned char> I[4]; // pyramid with 4 levels
vpImageIo::read(I[1], "myImage.pgm"); // Original image at level 1
// compute the other levels
I5[1].doubleSizeImage(I5[0]); // double size image at level 0
I5[1].halfSizeImage(I5[2]); // half size image at level 2
I5[1].quarterSizeImage(I5[3]); // quarter size image at level 3

Definition at line 938 of file vpImage.h.

References vpImage< Type >::resize().

template<class Type>
void vpImage< Type >::halfSizeImage ( vpImage< Type > *  res)
Deprecated:
This method is deprecated. You should use halfSizeImage(vpImage<Type> &) instead.

Returns a new image that's half size of the current image. No filtering is used during the sub sampling. Used for building pyramid of the image.

Warning
Operator = must be defined for Type.
Exceptions
vpException::memoryAllocationErrorIf images pointer is NULL or if the images size differ.

Definition at line 1502 of file vpImage.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().

template<class Type >
void vpImage< Type >::init ( unsigned int  h,
unsigned int  w 
)

set the size of the image

Image initialization.

Allocate memory for an [h x w] image.

Parameters
w: Image width.
h: Image height.

Element of the bitmap are not initialized

If the image has been already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Exceptions
vpException::memoryAllocationError

Definition at line 386 of file vpImage.h.

References vpException::memoryAllocationError, vpDEBUG_TRACE, and vpERROR_TRACE.

Referenced by vpPlot::init(), and vpImage< Type >::vpImage().

template<class Type>
void vpImage< Type >::init ( unsigned int  h,
unsigned int  w,
Type  value 
)

set the size of the image

Image initialisation.

Allocate memory for an [h x w] image.

Parameters
w: Image width.
h: Image height.
value: Set all the element of the bitmap to value.
Exceptions
vpException::memoryAllocationError
See also
vpImage::init(h, w)

Definition at line 350 of file vpImage.h.

References vpERROR_TRACE.

template<class Type>
void vpImage< Type >::insert ( const vpImage< Type > &  src,
const vpImagePoint  topLeft 
)

Insert an image into another one.

It is possible to insert the image $ src $ into the calling vpImage. You can set the point in the destination image where the top left corner of the $ src $ image will belocated.

Parameters
src: Image to insert
topLeft: Coordinates of the $ src $ image's top left corner in the destination image.

Definition at line 855 of file vpImage.h.

References vpImage< Type >::bitmap, vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

Referenced by vpKeyPoint::insertImageMatching().

template<class Type>
bool vpImage< Type >::operator!= ( const vpImage< Type > &  I)

Compare two images.

Returns
true if the images are different, false if they are the same.

Definition at line 797 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

template<class Type>
Type vpImage< Type >::operator() ( const unsigned int  i,
const unsigned int  j 
) const
inline

Get the value of an image point.

Parameters
i,j: Image point coordinates; i for the row position, j for the column position.
Returns
Value of the image point (i, j).

Definition at line 237 of file vpImage.h.

template<class Type>
void vpImage< Type >::operator() ( const unsigned int  i,
const unsigned int  j,
const Type &  v 
)
inline

Set the value of an image point.

Parameters
i,jImage point coordinates; i for the row position, j for the column position.
v: Value to set for image point (i, j).

Definition at line 250 of file vpImage.h.

template<class Type>
Type vpImage< Type >::operator() ( const vpImagePoint ip) const
inline

Get the value of an image point.

Parameters
ip: An image point with sub-pixel coordinates. Sub-pixel coordinates are roughly transformed to insigned int coordinates by cast.
Returns
Value of the image point ip.
See also
getValue(const vpImagePoint &)

Definition at line 266 of file vpImage.h.

template<class Type>
void vpImage< Type >::operator() ( const vpImagePoint ip,
const Type &  v 
)
inline

Set the value of an image point.

Parameters
ip: An image point with sub-pixel coordinates. Sub-pixel coordinates are roughly transformed to insigned int coordinates by cast.
v: Value to set for the image point.

Definition at line 282 of file vpImage.h.

template<class Type>
vpImage< Type > vpImage< Type >::operator- ( const vpImage< Type > &  B)

Operation A - B (A is unchanged).

#include <visp/vpImage.h>
int main()
{
A = 128;
B = 120;
// operator-() : C = A - B
C = A - B;
return 0;
}
See also
sub(const vpImage<Type> &, const vpImage<Type> &, vpImage<Type> &) to avoid matrix allocation for each use.

Definition at line 838 of file vpImage.h.

template<class Type>
vpImage< Type > & vpImage< Type >::operator= ( const vpImage< Type > &  I)

Copy operator.

Definition at line 702 of file vpImage.h.

References vpImage< Type >::bitmap, vpException::memoryAllocationError, and vpERROR_TRACE.

template<class Type>
vpImage< Type > & vpImage< Type >::operator= ( const Type &  v)

= operator : Set all the element of the bitmap to a given value v. $ A = v <=> A[i][j] = v $

Warning
= must be defined for $ <$ Type $ > $

Definition at line 763 of file vpImage.h.

template<class Type>
bool vpImage< Type >::operator== ( const vpImage< Type > &  I)

Compare two images.

Returns
true if the images are the same, false otherwise.

Definition at line 777 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

template<class Type>
Type* vpImage< Type >::operator[] ( const unsigned int  i)
inline

operator[] allows operation like I[i] = x.

Definition at line 221 of file vpImage.h.

template<class Type>
Type* vpImage< Type >::operator[] ( const int  i)
inline

Definition at line 222 of file vpImage.h.

template<class Type>
const Type* vpImage< Type >::operator[] ( unsigned int  i) const
inline

operator[] allows operation like x = I[i]

Definition at line 225 of file vpImage.h.

template<class Type>
const Type* vpImage< Type >::operator[] ( int  i) const
inline

Definition at line 226 of file vpImage.h.

template<class Type>
void vpImage< Type >::quarterSizeImage ( vpImage< Type > &  res)

Returns a new image that's a quarter size of the current image. No filtering is used during the sub sampling. Used for building a quarter of the image.

Warning
Operator = must be defined for Type.
Parameters
res[out] : Subsampled image that is quarter size of the current image.

The example below shows how to use this method:

vpImage<unsigned char> I; // original image
vpImageIo::read(I, "myImage.pgm");
vpImage<unsigned char> I4; // quarter size image
vpImageIo::write(I4, "myQuarterSizeImage.pgm");

See halfSizeImage(vpImage<Type> &) for an example of pyramid construction.

Definition at line 972 of file vpImage.h.

References vpImage< Type >::resize().

template<class Type>
void vpImage< Type >::quarterSizeImage ( vpImage< Type > *  res)
Deprecated:
This method is deprecated. You should use quarterSizeImage(vpImage<Type> &) instead.

Returns a new image that's a quarter size of the current image. Used for building a quarter of the image.

Warning
Operator = must be defined for Type.
Exceptions
vpException::memoryAllocationErrorIf images pointer is NULL or if the images size differ.

Definition at line 1530 of file vpImage.h.

References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().

template<class Type >
void vpImage< Type >::resize ( const unsigned int  h,
const unsigned int  w 
)

set the size of the image without initializing it.

resize the image : Image initialization

Allocate memory for an [height x width] image.

Warning
The image is not initialized.
Parameters
w: Image width.
h: Image height.

Element of the bitmap are not initialized

If the image has been already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Exceptions
vpException::memoryAllocationError
See also
init(unsigned int, unsigned int)

Definition at line 536 of file vpImage.h.

References vpERROR_TRACE.

Referenced by vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vpImageConvert::convert(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpImage< Type >::doubleSizeImage(), vpImageFilter::filter(), vpImageFilter::filterX(), vpImageFilter::filterY(), vpImageTools::flip(), vpImageFilter::getGaussXPyramidal(), vpImageFilter::getGaussYPyramidal(), vpImageFilter::getGradX(), vpImageFilter::getGradY(), vpDisplayX::getImage(), vpDisplayGTK::getImage(), vpSimulator::getInternalImage(), vpAROgre::getRenderingOutput(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpProjectionDisplay::init(), vpV4l2Grabber::open(), vp1394CMUGrabber::open(), vpImage< Type >::quarterSizeImage(), vpImageIo::readJPEG(), vpImageIo::readPFM(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpImageIo::readPPM(), vpImageConvert::split(), vpImage< Type >::sub(), vpImageTools::undistort(), vpImage< Type >::vpImage(), vpKinect::vpKinect(), vpRobotWireFrameSimulator::vpRobotWireFrameSimulator(), vpKinect::warpRGBFrame(), and vpImageIo::writePGM().

template<class Type>
void vpImage< Type >::resize ( const unsigned int  h,
const unsigned int  w,
const Type  val 
)

set the size of the image and initialize it.

resize the image : Image initialization

Allocate memory for an [height x width] image and initialize the image.

Parameters
w: Image width.
h: Image height.
val: Pixels value.

Element of the bitmap are not initialized

If the image has been already initialized, memory allocation is done only if the new image size is different, else we re-use the same memory space.

Exceptions
vpException::memoryAllocationError
See also
init(unsigned int, unsigned int)

Definition at line 570 of file vpImage.h.

References vpERROR_TRACE.

template<class Type>
void vpImage< Type >::sub ( const vpImage< Type > &  B,
vpImage< Type > &  C 
)

Operation C = *this - B.

#include <visp/vpImage.h>
int main()
{
A = 128;
B = 120;
A.sub(B, C); // C = A - B
return 0;
}

The result is placed in the third parameter C and not returned. A new image won't be allocated for every use of the function (Speed gain if used many times with the same result matrix size).

Exceptions
vpException::memoryAllocationErrorIf the images size differ.
See also
operator-()

Definition at line 1383 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, vpImage< Type >::resize(), and vpERROR_TRACE.

template<class Type>
void vpImage< Type >::sub ( const vpImage< Type > &  A,
const vpImage< Type > &  B,
vpImage< Type > &  C 
)

Operation C = A - B.

The result is placed in the third parameter C and not returned. A new image won't be allocated for every use of the function (Speed gain if used many times with the same result matrix size).

Exceptions
vpException::memoryAllocationErrorIf the images size differ.
See also
operator-()

Definition at line 1424 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, vpImage< Type >::resize(), and vpERROR_TRACE.

template<class Type>
void vpImage< Type >::sub ( vpImage< Type > *  B,
vpImage< Type > *  C 
)
Deprecated:
This method is deprecated. You should use vpImage<Type>::sub(const vpImage<Type> &, vpImage<Type> &) instead.

Operation C = *this - B.

The result is placed in parameter C.

See also
operator-()
Exceptions
vpException::memoryAllocationErrorIf images pointer is NULL or if the images size differ.

Definition at line 1467 of file vpImage.h.

References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpERROR_TRACE.

Friends And Related Function Documentation

template<class Type>
friend class vpImageConvert
friend

Definition at line 117 of file vpImage.h.

Member Data Documentation