ViSP
2.8.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 height, const unsigned int width) |
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) |
const Type * | operator[] (unsigned 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) |
void | operator= (const vpImage< Type > &I) |
void | 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) |
template<> | |
double | getValue (double i, double j) const |
template<> | |
double | getValue (vpImagePoint &ip) const |
Public Attributes | |
Type * | bitmap |
vpDisplay * | display |
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) |
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.
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 )
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]).
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.
To provide high-performance access there is no verification to ensure that 0 i < height and 0 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:
copy constructor
Copy constructor
Definition at line 598 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), and vpERROR_TRACE.
constructor set the size of the image
Constructor.
Allocate memory for an [height x width] image
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.
vpException::memoryAllocationError |
Definition at line 445 of file vpImage.h.
References vpERROR_TRACE.
vpImage< Type >::vpImage | ( | unsigned int | height, |
unsigned int | width, | ||
Type | value | ||
) |
constructor set the size of the image and init all the pixel
Constructor.
Allocate memory for an [height x width] image
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.
Definition at line 479 of file vpImage.h.
References vpERROR_TRACE.
void vpImage< Type >::destroy | ( | ) |
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:
res | [out] : Image that is double size of the current image. |
The example below shows how to use this method:
See halfSizeImage(vpImage<Type> &) for an example of pyramid construction.
Definition at line 988 of file vpImage.h.
References vpImage< Type >::resize().
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)
vpException::memoryAllocationError | If images pointer is NULL or if the images size differ. |
Definition at line 1529 of file vpImage.h.
References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().
|
inline |
Get the number of columns in the image.
Definition at line 178 of file vpImage.h.
Referenced by vpImageConvert::convert(), and vpMomentObject::fromImage().
|
inline |
Get the image height.
Definition at line 150 of file vpImage.h.
Referenced by vpDiskGrabber::acquire(), vp1394Grabber::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(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpImageMorphology::dilatation(), vpMbtDistanceLine::display(), vpMeLine::display(), vpMbKltTracker::display(), vpWireFrameSimulator::display_scene(), vpDisplayOpenCV::displayImage(), vpDisplayX::displayImage(), vpDisplayOpenCV::displayImageROI(), vpFeatureDisplay::displayLine(), vpDisplay::displayROI(), vpImage< Type >::doubleSizeImage(), vpImageMorphology::erosion(), vpImageFilter::filter(), vpImageTools::flip(), vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpServolens::getCameraParameters(), vpAfma6::getCameraParameters(), vpSimulatorAfma6::getCameraParameters(), vpSimulatorViper850::getCameraParameters(), vpKinect::getDepthMap(), vpRobotWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpDisplayX::getImage(), vpImageSimulator::getImage(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpMbtPolygon::getNbCornerInsideImage(), vpAROgre::getRenderingOutput(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpDisplayWin32::init(), vpAROgre::init(), vpDisplayX::init(), vpDisplayOpenCV::init(), vpDisplayGTK::init(), vpMbKltTracker::init(), vpMbEdgeTracker::init(), vpMbtDistanceLine::initMovingEdge(), vpMbEdgeTracker::initPyramid(), vpImage< Type >::insert(), 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(), vpImageTools::undistort(), vpMbtDistanceLine::updateMovingEdge(), vpImage< Type >::vpImage(), vpKinect::warpRGBFrame(), vpImageIo::writeJPEG(), vpImageIo::writePFM(), vpImageIo::writePGM(), vpImageIo::writePNG(), and vpImageIo::writePPM().
Type vpImage< Type >::getMaxValue | ( | ) | const |
Return the maximum value within the bitmap.
void vpImage< Type >::getMinMaxValue | ( | Type & | min, |
Type & | max | ||
) | const |
Look for the minimum and the maximum value within the bitmap.
Definition at line 662 of file vpImage.h.
Referenced by vpImageConvert::convert().
Type vpImage< Type >::getMinValue | ( | ) | const |
Return the minimum value within the bitmap.
|
inline |
Get the image number of pixels which corresponds to the image width multiplied by the image height.
Definition at line 212 of file vpImage.h.
Referenced by vpImageConvert::split().
|
inline |
Get the number of rows in the image.
Definition at line 169 of file vpImage.h.
Referenced by vpImageConvert::convert(), and vpMomentObject::fromImage().
|
inline |
Get the image size.
Definition at line 187 of file vpImage.h.
Referenced by vp1394CMUGrabber::acquire().
Type vpImage< Type >::getValue | ( | double | i, |
double | j | ||
) | const |
Definition at line 1039 of file vpImage.h.
References vpTRACE.
Type vpImage< Type >::getValue | ( | vpImagePoint & | ip | ) | const |
Definition at line 1204 of file vpImage.h.
References vpTRACE.
|
inline |
Retrieves pixel value from an image of double with sub-pixel accuracy.
Gets the value of a sub-pixel with coordinates (i,j) with bilinear interpolation. If location is out of bounds, then return value of closest pixel.
i | : Sub-pixel coordinate along the rows. |
j | : Sub-pixel coordinate along the columns. |
vpImageException::notInTheImage | : If (i,j) is out of the image. |
Definition at line 1117 of file vpImage.h.
References vpImageException::notInTheImage, and vpERROR_TRACE.
|
inline |
Definition at line 1248 of file vpImage.h.
References vpImagePoint::get_i(), vpImagePoint::get_j(), vpImageException::notInTheImage, vpImagePoint::set_i(), vpImagePoint::set_j(), and vpERROR_TRACE.
|
inline |
Get the image width.
Definition at line 159 of file vpImage.h.
Referenced by vpDiskGrabber::acquire(), vp1394Grabber::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(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpImageMorphology::dilatation(), vpMbtDistanceLine::display(), vpMeLine::display(), vpMbKltTracker::display(), vpWireFrameSimulator::display_scene(), vpDisplayOpenCV::displayImage(), vpDisplayX::displayImage(), vpDisplayOpenCV::displayImageROI(), vpDisplayX::displayImageROI(), vpFeatureDisplay::displayLine(), vpDisplay::displayROI(), vpImage< Type >::doubleSizeImage(), vpImageMorphology::erosion(), vpImageFilter::filter(), vpImageTools::flip(), vpViper650::getCameraParameters(), vpViper850::getCameraParameters(), vpServolens::getCameraParameters(), vpAfma6::getCameraParameters(), vpSimulatorAfma6::getCameraParameters(), vpSimulatorViper850::getCameraParameters(), vpRobotWireFrameSimulator::getExternalCameraParameters(), vpWireFrameSimulator::getExternalCameraParameters(), vpSimulatorAfma6::getExternalImage(), vpSimulatorViper850::getExternalImage(), vpWireFrameSimulator::getExternalImage(), vpDisplayX::getImage(), vpImageSimulator::getImage(), vpWireFrameSimulator::getInternalCameraParameters(), vpWireFrameSimulator::getInternalImage(), vpRobotWireFrameSimulator::getInternalView(), vpMbtPolygon::getNbCornerInsideImage(), vpAROgre::getRenderingOutput(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpDisplayWin32::init(), vpAROgre::init(), vpDisplayX::init(), vpDisplayOpenCV::init(), vpDisplayGTK::init(), vpMbKltTracker::init(), vpMbEdgeTracker::init(), vpMbtDistanceLine::initMovingEdge(), vpMbEdgeTracker::initPyramid(), vpImage< Type >::insert(), 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(), vpImageTools::undistort(), vpMbtDistanceLine::updateMovingEdge(), vpImage< Type >::vpImage(), vpKinect::warpRGBFrame(), vpImageIo::writeJPEG(), vpImageIo::writePFM(), vpImageIo::writePGM(), vpImageIo::writePNG(), and vpImageIo::writePPM().
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.
res | [out] : Subsampled image that is half size of the current image. |
The example below shows how to use this method:
This other example shows how to construct a pyramid of the image:
Definition at line 909 of file vpImage.h.
References vpImage< Type >::resize().
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.
vpException::memoryAllocationError | If images pointer is NULL or if the images size differ. |
Definition at line 1473 of file vpImage.h.
References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().
void vpImage< Type >::init | ( | unsigned int | height, |
unsigned int | width | ||
) |
set the size of the image
Image initialization.
Allocate memory for an [height x width] image
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.
vpException::memoryAllocationError |
Definition at line 377 of file vpImage.h.
References vpException::memoryAllocationError, vpDEBUG_TRACE, and vpERROR_TRACE.
Referenced by vpPlot::init().
void vpImage< Type >::init | ( | unsigned int | height, |
unsigned int | width, | ||
Type | value | ||
) |
set the size of the image
Image initialisation.
Allocate memory for an [height x width] image
Set all the element of the bitmap to value
vpException::memoryAllocationError |
Definition at line 344 of file vpImage.h.
References vpERROR_TRACE.
void vpImage< Type >::insert | ( | const vpImage< Type > & | src, |
const vpImagePoint | topLeft | ||
) |
Insert an image into another one.
It is possible to insert the image into the calling vpImage. You can set the point in the destination image where the top left corner of the image will belocated.
src | : Image to insert |
topLeft | : Coordinates of the image's top left corner in the destination image. |
Definition at line 826 of file vpImage.h.
References vpImage< Type >::bitmap, vpImagePoint::get_i(), vpImagePoint::get_j(), vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
Compare two images.
Definition at line 768 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
|
inline |
|
inline |
|
inline |
|
inline |
Operation A - B (A is unchanged).
Copy operator.
Definition at line 676 of file vpImage.h.
References vpImage< Type >::bitmap, vpException::memoryAllocationError, and vpERROR_TRACE.
void vpImage< Type >::operator= | ( | const Type & | v | ) |
Compare two images.
Definition at line 748 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().
|
inline |
|
inline |
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.
res | [out] : Subsampled image that is quarter size of the current image. |
The example below shows how to use this method:
See halfSizeImage(vpImage<Type> &) for an example of pyramid construction.
Definition at line 943 of file vpImage.h.
References vpImage< Type >::resize().
Returns a new image that's a quarter size of the current image. Used for building a quarter of the image.
vpException::memoryAllocationError | If images pointer is NULL or if the images size differ. |
Definition at line 1501 of file vpImage.h.
References vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpImage< Type >::resize().
void vpImage< Type >::resize | ( | const unsigned int | height, |
const unsigned int | width | ||
) |
set the size of the image
resize the image : Image initialization
Allocate memory for an [height x width] image
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.
vpException::memoryAllocationError |
Definition at line 535 of file vpImage.h.
References vpERROR_TRACE.
Referenced by vp1394Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vpImageConvert::convert(), vpImageTools::createSubImage(), vp1394TwoGrabber::dequeue(), vpImage< Type >::doubleSizeImage(), vpImageFilter::filter(), vpImageTools::flip(), vpDisplayX::getImage(), vpDisplayGTK::getImage(), vpSimulator::getInternalImage(), vpAROgre::getRenderingOutput(), vpImage< Type >::halfSizeImage(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpProjectionDisplay::init(), vp1394Grabber::open(), vpV4l2Grabber::open(), vp1394CMUGrabber::open(), vpImage< Type >::quarterSizeImage(), vpImageIo::readJPEG(), vpImageIo::readPFM(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpImageIo::readPPM(), vpMbHiddenFaces< vpMbtKltPolygon >::setBackgroundSizeOgre(), vpImageConvert::split(), vpImage< Type >::sub(), vpImageTools::undistort(), vpKinect::vpKinect(), vpRobotWireFrameSimulator::vpRobotWireFrameSimulator(), vpKinect::warpRGBFrame(), and vpImageIo::writePGM().
Operation C = *this - 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).
vpException::memoryAllocationError | If the images size differ. |
Definition at line 1354 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, vpImage< Type >::resize(), and vpERROR_TRACE.
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).
vpException::memoryAllocationError | If the images size differ. |
Definition at line 1395 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, vpImage< Type >::resize(), and vpERROR_TRACE.
Operation C = *this - B.
The result is placed in parameter C.
vpException::memoryAllocationError | If images pointer is NULL or if the images size differ. |
Definition at line 1438 of file vpImage.h.
References vpImage< Type >::bitmap, vpImage< Type >::getHeight(), vpImage< Type >::getWidth(), vpException::memoryAllocationError, and vpERROR_TRACE.
|
friend |
Type* vpImage< Type >::bitmap |
points toward the bitmap
Definition at line 120 of file vpImage.h.
Referenced by vp1394CMUGrabber::acquire(), vp1394Grabber::acquire(), vpV4l2Grabber::acquire(), vp1394TwoGrabber::acquire(), vpImageTools::binarise(), vpKeyPointSurf::buildReference(), vpImageConvert::convert(), vp1394TwoGrabber::dequeue(), vpKltOpencv::display(), vpDisplayX::displayImage(), vpDisplayGTK::displayImage(), vpDisplayX::displayImageROI(), vpDisplayGTK::displayImageROI(), vpImageTools::flip(), vpDisplayX::getImage(), vpDisplayGTK::getImage(), vpImageSimulator::getImage(), vpSimulator::getInternalImage(), vpAROgre::getRenderingOutput(), vpImageTools::imageDifference(), vpImageTools::imageDifferenceAbsolute(), vpMbEdgeTracker::initPyramid(), vpImage< Type >::insert(), vpKeyPointSurf::matchPoint(), vpImage< Type >::operator!=(), vpImage< Type >::operator=(), vpImage< Type >::operator==(), vpImageIo::readJPEG(), vpImageIo::readPFM(), vpImageIo::readPGM(), vpImageIo::readPNG(), vpFernClassifier::setImage(), vpImageConvert::split(), vpImage< Type >::sub(), vpImageTools::undistort(), vpAROgre::updateBackgroundTexture(), vpImage< Type >::vpImage(), vpImageIo::writeJPEG(), vpImageIo::writePFM(), vpImageIo::writePGM(), and vpImageIo::writePNG().
Definition at line 121 of file vpImage.h.
Referenced by vpDisplay::close(), vpDisplay::display(), vpDisplay::displayArrow(), vpDisplay::displayCharString(), vpDisplay::displayCircle(), vpDisplay::displayCross(), vpDisplay::displayDotLine(), vpDisplay::displayLine(), vpDisplay::displayPoint(), vpDisplay::displayRectangle(), vpDisplay::displayROI(), vpDisplay::flush(), vpDisplay::flushROI(), vpDisplay::getClick(), vpDisplay::getClickUp(), vpWireFrameSimulator::getExternalImage(), vpDisplay::getImage(), vpWireFrameSimulator::getInternalImage(), vpDisplay::getKeyboardEvent(), vpDisplay::getPointerMotionEvent(), vpDisplay::getPointerPosition(), vpDisplayWin32::init(), vpDisplayX::init(), vpDisplayOpenCV::init(), vpDisplayGTK::init(), vpDisplay::setBackground(), vpDisplay::setFont(), vpDisplay::setTitle(), and vpDisplay::setWindowPosition().