libvisiontransfer
7.1.0
|
A set of two images, which are usually the left camera image and the disparity map. More...
#include <visiontransfer/imagepair.h>
Public Types | |
enum | ImageFormat { FORMAT_8_BIT_MONO, FORMAT_8_BIT_RGB, FORMAT_12_BIT_MONO } |
Image formats that can be transferred. More... | |
enum | ImageFormat_Deprecated { FORMAT_8_BIT = FORMAT_8_BIT_MONO, FORMAT_12_BIT = FORMAT_12_BIT_MONO } |
Public Member Functions | |
ImagePair () | |
Default constructor creating an image pair with no pixel data. More... | |
ImagePair (const ImagePair &other) | |
Copy constructor creating a shallow copy of the image pair. More... | |
ImagePair & | operator= (ImagePair const &other) |
void | setWidth (int w) |
Sets a new width for both images. More... | |
void | setHeight (int h) |
Sets a new width for both images. More... | |
void | setRowStride (int imageNumber, int stride) |
Sets a new row stride for the pixel data of one image. More... | |
void | setPixelFormat (int imageNumber, ImageFormat format) |
Sets the pixel format for the given image. More... | |
void | setPixelData (int imageNumber, unsigned char *pixelData) |
Sets the pixel data for the given image. More... | |
void | setQMatrix (const float *q) |
Sets the pointer to the disparity-to-depth mapping matrix q. More... | |
void | setSequenceNumber (unsigned int num) |
Sets the sequence number for this image pair. More... | |
void | setTimestamp (int seconds, int microsec) |
Sets the time at which this image pair has been captured. More... | |
void | setDisparityRange (int minimum, int maximum) |
Sets the value range for the disparity map contained in this image pair. More... | |
void | setSubpixelFactor (int subpixFact) |
Sets the subpixel factor for this image pair. More... | |
void | setImageDisparityPair (bool dispPair) |
Sets whether this is a left camera image and disparity map pair, or two raw camera images. More... | |
int | getWidth () const |
Returns the width of each image. More... | |
int | getHeight () const |
Returns the height of each image. More... | |
int | getRowStride (int imageNumber) const |
Returns the row stride for the pixel data of one image. More... | |
ImageFormat | getPixelFormat (int imageNumber) const |
Returns the pixel format for the given image. More... | |
unsigned char * | getPixelData (int imageNumber) const |
Returns the pixel data for the given image. More... | |
const float * | getQMatrix () const |
Returns a pointer to the disparity-to-depth mapping matrix q. More... | |
unsigned int | getSequenceNumber () const |
Returns the sequence number for this image pair. More... | |
void | getTimestamp (int &seconds, int µsec) const |
Returns the time at which this image pair has been captured. More... | |
void | getDisparityRange (int &minimum, int &maximum) const |
Gets the value range for the disparity map contained in this image pair. If the image pair does not contain any disparity data then the disparity range is undefined. More... | |
int | getSubpixelFactor () const |
Gets the subpixel factor for this image pair. More... | |
void | writePgmFile (int imageNumber, const char *fileName) const |
Writes one image of the pair to a PGM or PPM file. More... | |
bool | isImageDisparityPair () const |
Returns true if this is a left camera image and disparity map pair. More... | |
void | copyTo (ImagePair &dest) |
Makes a deep copy of this image pair. More... | |
int | getBytesPerPixel (int imageNumber) const |
Returns the number of bytes that are required to store one image pixel. More... | |
void | toOpenCVImage (int imageNumber, cv::Mat &dest, bool convertRgbToBgr=true) |
Converts one image of the pair to an OpenCV image. More... | |
Static Public Member Functions | |
static int | getBytesPerPixel (ImageFormat format) |
Returns the number of bytes that are required to store one image pixel with the given pixel format. More... | |
A set of two images, which are usually the left camera image and the disparity map.
Both images must be of equal width and height, but are allowed to have a different pixel formats. Please note that the class does not manage the pixel data but only keeps pointers. You thus need to ensure that the pixel data remains valid for as long as this object persists.
Definition at line 33 of file imagepair.h.
Image formats that can be transferred.
Enumerator | |
---|---|
FORMAT_8_BIT_MONO | 8-bit greyscale format |
FORMAT_8_BIT_RGB | 8-bit RGB format |
FORMAT_12_BIT_MONO | 12-bit greyscale format plus 4 bits of padding (hence a total of 16 bits). |
Definition at line 38 of file imagepair.h.
ImageFormat
. Definition at line 53 of file imagepair.h.
visiontransfer::ImagePair::ImagePair | ( | ) |
Default constructor creating an image pair with no pixel data.
Definition at line 31 of file imagepair.cpp.
visiontransfer::ImagePair::ImagePair | ( | const ImagePair & | other | ) |
Copy constructor creating a shallow copy of the image pair.
Definition at line 43 of file imagepair.cpp.
void visiontransfer::ImagePair::copyTo | ( | ImagePair & | dest | ) |
Makes a deep copy of this image pair.
Definition at line 147 of file imagepair.cpp.
|
inline |
Returns the number of bytes that are required to store one image pixel.
imageNumber | The number of the image (0 or 1). |
Definition at line 293 of file imagepair.h.
|
static |
Returns the number of bytes that are required to store one image pixel with the given pixel format.
Definition at line 171 of file imagepair.cpp.
|
inline |
Gets the value range for the disparity map contained in this image pair. If the image pair does not contain any disparity data then the disparity range is undefined.
minimum | Minimum disparity value. |
maximum | Maximum disparity value. |
Definition at line 254 of file imagepair.h.
|
inline |
Returns the height of each image.
Definition at line 187 of file imagepair.h.
|
inline |
Returns the pixel data for the given image.
imageNumber | Number of the image for which to receive the pixel data (0 or 1). |
Definition at line 217 of file imagepair.h.
|
inline |
Returns the pixel format for the given image.
imageNumber | Number of the image for which to receive the pixel format (0 or 1). |
Definition at line 206 of file imagepair.h.
|
inline |
Returns a pointer to the disparity-to-depth mapping matrix q.
Definition at line 225 of file imagepair.h.
|
inline |
Returns the row stride for the pixel data of one image.
imageNumber | Number of the image for which to receive the row stride (0 or 1). |
Definition at line 195 of file imagepair.h.
|
inline |
Returns the sequence number for this image pair.
Definition at line 232 of file imagepair.h.
|
inline |
Gets the subpixel factor for this image pair.
Definition at line 262 of file imagepair.h.
|
inline |
Returns the time at which this image pair has been captured.
seconds | The time stamp with a resolution of one second. |
microsec | The fractional seconds part of the time stamp with a resolution of 1 microsecond. |
Definition at line 241 of file imagepair.h.
|
inline |
Returns the width of each image.
Definition at line 182 of file imagepair.h.
|
inline |
Returns true if this is a left camera image and disparity map pair.
Definition at line 278 of file imagepair.h.
|
inline |
Sets the value range for the disparity map contained in this image pair.
minimum | Minimum disparity value. |
maximum | Maximum disparity value. |
Definition at line 159 of file imagepair.h.
|
inline |
Sets a new width for both images.
Definition at line 79 of file imagepair.h.
|
inline |
Sets whether this is a left camera image and disparity map pair, or two raw camera images.
Definition at line 175 of file imagepair.h.
|
inline |
Sets the pixel data for the given image.
imageNumber | Number of the image for which to set the pixel data (0 or 1). |
pixelData | The pixel data that shall be set. |
Definition at line 118 of file imagepair.h.
|
inline |
Sets the pixel format for the given image.
imageNumber | Number of the image for which to set the pixel format (0 or 1). |
format | The pixel format that shall be set. |
Definition at line 100 of file imagepair.h.
|
inline |
Sets the pointer to the disparity-to-depth mapping matrix q.
No data is copied. The data which q is pointing to has to remain valid for as long as this object exists.
Definition at line 129 of file imagepair.h.
|
inline |
Sets a new row stride for the pixel data of one image.
imageNumber | Number of the image for which to set the row stride (0 or 1). |
stride | The row stride that shall be set. |
Definition at line 88 of file imagepair.h.
|
inline |
Sets the sequence number for this image pair.
Definition at line 136 of file imagepair.h.
|
inline |
Sets the subpixel factor for this image pair.
Definition at line 167 of file imagepair.h.
|
inline |
Sets the time at which this image pair has been captured.
seconds | The time stamp with a resolution of one second. |
microsec | The fractional seconds part of the time stamp with a resolution of 1 microsecond. |
Definition at line 147 of file imagepair.h.
|
inline |
Sets a new width for both images.
Definition at line 74 of file imagepair.h.
|
inline |
Converts one image of the pair to an OpenCV image.
imageNumber | The number of the image that shall be converted (0 or 1). |
convertRgbToBgr | If true, then color images will converted from RGB to BGR in order to comply to OpenCV's convention. |
For this method to be available, the OpenCV headers need to be included before including headers for libvisiontransfer.
Please note that only a shallow copy is performed. The ImagePair object must be kept alive for as long as the OpenCV image is in use.
Definition at line 27 of file imagepair-opencv.h.
void visiontransfer::ImagePair::writePgmFile | ( | int | imageNumber, |
const char * | fileName | ||
) | const |
Writes one image of the pair to a PGM or PPM file.
imageNumber | The number of the image that shall be written. |
File | name of the PGM or PPM file that shall be created. |
Definition at line 98 of file imagepair.cpp.