libvisiontransfer
10.6.0
|
A set of one to three images, but usually two (the left camera image and the disparity map). One- and three-image modes can be enabled in the device configuration interface.
For backwards compatibility, for sets of at least two images the image at index 0 is always the left camera image, while the one at index 1 is either the disparity map if in disparity processing mode, or the right image otherwise.
All images must be of equal width and height, but are allowed to have 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 50 of file imageset.h.
#include <visiontransfer/imageset.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 } |
enum | ImageType { IMAGE_UNDEFINED, IMAGE_LEFT, IMAGE_DISPARITY, IMAGE_RIGHT, IMAGE_COLOR } |
Supported image types. More... | |
Public Member Functions | |
ImageSet () | |
Default constructor creating an image set with no pixel data. More... | |
ImageSet (const ImageSet &other) | |
Copy constructor creating a shallow copy of the image set. More... | |
ImageSet & | operator= (ImageSet 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 set. More... | |
void | setTimestamp (int seconds, int microsec) |
Sets the time at which this image set has been captured. More... | |
void | setDisparityRange (int minimum, int maximum) |
Sets the value range for the disparity map contained in this image set. More... | |
void | setSubpixelFactor (int subpixFact) |
Sets the subpixel factor for this image set. 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... | |
int | getRowStride (ImageType what) 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... | |
ImageFormat | getPixelFormat (ImageType what) 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... | |
unsigned char * | getPixelData (ImageType what) 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 set. More... | |
void | getTimestamp (int &seconds, int µsec) const |
Returns the time at which this image set has been captured. More... | |
void | getDisparityRange (int &minimum, int &maximum) const |
Gets the value range for the disparity map contained in this image set. If the image set does not contain any disparity data then the disparity range is undefined. More... | |
int | getSubpixelFactor () const |
Gets the subpixel factor for this image set. More... | |
void | writePgmFile (int imageNumber, const char *fileName) const |
Writes one image of the set to a PGM or PPM file. More... | |
void | copyTo (ImageSet &dest) |
Makes a deep copy of this image set. More... | |
int | getBytesPerPixel (int imageNumber) const |
Returns the number of bytes that are required to store one image pixel. More... | |
int | getBitsPerPixel (int imageNumber) const |
Returns the number of bits that are required to store one image pixel. More... | |
int | getBitsPerPixel (ImageType what) const |
int | getNumberOfImages () const |
Returns the number of images in this set. More... | |
void | setNumberOfImages (int number) |
Sets the number of valid images in this set. More... | |
ImageType | getImageType (int imageNumber) const |
Returns the ImageType of the specified channel. More... | |
int | getIndexOf (ImageType what, bool throwIfNotFound=false) const |
Returns the index of a specific image type. More... | |
bool | hasImageType (ImageType what) const |
Returns whether a left camera image is included in the enabled data. More... | |
void | setIndexOf (ImageType what, int idx) |
Assign an image index to a specified ImageType, -1 to disable. More... | |
void | toOpenCVImage (int imageNumber, cv::Mat &dest, bool convertRgbToBgr=true) |
Converts one image of the set to an OpenCV image. More... | |
void | setExposureTime (int timeMicrosec) |
Sets the exposure time that was used for capturing the image set. More... | |
int | getExposureTime () const |
Gets the exposure time in microseconds that was used for capturing the image set. More... | |
void | setLastSyncPulse (int seconds, int microsec) |
Sets the timestamp of the last received sync pulse. More... | |
void | getLastSyncPulse (int &seconds, int µsec) const |
Gets the timestamp of the last received sync pulse. More... | |
Static Public Member Functions | |
static int | getBitsPerPixel (ImageFormat format) |
static int | getBytesPerPixel (ImageFormat format) |
Returns the number of bytes that are required to store one image pixel with the given pixel format. More... | |
Static Public Attributes | |
static const int | MAX_SUPPORTED_IMAGES = 4 |
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 68 of file imageset.h.
ImageFormat
. Definition at line 83 of file imageset.h.
Supported image types.
Enumerator | |
---|---|
IMAGE_COLOR | 3rd color camera for devices where this is supported |
Definition at line 91 of file imageset.h.
visiontransfer::ImageSet::ImageSet | ( | ) |
Default constructor creating an image set with no pixel data.
Definition at line 31 of file imageset.cpp.
visiontransfer::ImageSet::ImageSet | ( | const ImageSet & | other | ) |
Copy constructor creating a shallow copy of the image set.
Definition at line 43 of file imageset.cpp.
void visiontransfer::ImageSet::copyTo | ( | ImageSet & | dest | ) |
Makes a deep copy of this image set.
Definition at line 164 of file imageset.cpp.
|
inline |
Returns the number of bits that are required to store one image pixel.
imageNumber | The number of the image (0 ... getNumberOfImages()-1). |
Definition at line 410 of file imageset.h.
|
static |
Returns the number of bytes that are required to store one image pixel with the given pixel format.
Definition at line 188 of file imageset.cpp.
|
inline |
Returns the number of bytes that are required to store one image pixel.
imageNumber | The number of the image (0 ... getNumberOfImages()-1). |
Definition at line 399 of file imageset.h.
|
inline |
Gets the value range for the disparity map contained in this image set. If the image set does not contain any disparity data then the disparity range is undefined.
minimum | Minimum disparity value. |
maximum | Maximum disparity value. |
Definition at line 349 of file imageset.h.
|
inline |
Gets the exposure time in microseconds that was used for capturing the image set.
Definition at line 509 of file imageset.h.
|
inline |
Returns the height of each image.
Definition at line 234 of file imageset.h.
ImageSet::ImageType visiontransfer::ImageSet::getImageType | ( | int | imageNumber | ) | const |
Returns the ImageType of the specified channel.
Definition at line 197 of file imageset.cpp.
int visiontransfer::ImageSet::getIndexOf | ( | ImageType | what, |
bool | throwIfNotFound = false |
||
) | const |
Returns the index of a specific image type.
what | ImageType of the desired channel. |
throwIfNotFound | Throw a runtime error instead of returning -1. |
Definition at line 214 of file imageset.cpp.
|
inline |
Gets the timestamp of the last received sync pulse.
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 532 of file imageset.h.
|
inline |
Returns the number of images in this set.
Definition at line 431 of file imageset.h.
|
inline |
Returns the pixel data for the given image.
what | ImageType of the desired channel. |
This function will throw an exception when the ImageType is not present in this set (use hasImageType(what) to check).
Definition at line 312 of file imageset.h.
|
inline |
Returns the pixel data for the given image.
imageNumber | Number of the image for which to receive the pixel data (0 ... getNumberOfImages()-1). |
Please use getPixelData(ImageSet::ImageType) to access the data by their abstract role in lieu of their index in the set.
Definition at line 299 of file imageset.h.
|
inline |
Returns the pixel format for the given image.
what | ImageType of the desired channel. |
This function will throw an exception when the ImageType is not present in this set (use hasImageType(what) to check).
Definition at line 285 of file imageset.h.
|
inline |
Returns the pixel format for the given image.
imageNumber | Number of the image for which to receive the pixel format (0 ... getNumberOfImages()-1). |
Please use getPixelFormat(ImageSet::ImageType) to access the data by their abstract role in lieu of their index in the set.
Definition at line 272 of file imageset.h.
|
inline |
Returns a pointer to the disparity-to-depth mapping matrix q.
Definition at line 320 of file imageset.h.
|
inline |
Returns the row stride for the pixel data of one image.
what | ImageType of the desired channel. |
This function will throw an exception when the ImageType is not present in this set (use hasImageType(what) to check).
Definition at line 258 of file imageset.h.
|
inline |
Returns the row stride for the pixel data of one image.
imageNumber | Number of the image for which to obtain the row stride (0 ... getNumberOfImages()-1). |
Please use getRowStride(ImageSet::ImageType) to access the data by their abstract role in lieu of their index in the set.
Definition at line 245 of file imageset.h.
|
inline |
Returns the sequence number for this image set.
Definition at line 327 of file imageset.h.
|
inline |
Gets the subpixel factor for this image set.
Definition at line 357 of file imageset.h.
|
inline |
Returns the time at which this image set 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 336 of file imageset.h.
|
inline |
Returns the width of each image.
Definition at line 229 of file imageset.h.
|
inline |
Returns whether a left camera image is included in the enabled data.
Definition at line 461 of file imageset.h.
|
inline |
Sets the value range for the disparity map contained in this image set.
minimum | Minimum disparity value. |
maximum | Maximum disparity value. |
Definition at line 202 of file imageset.h.
|
inline |
Sets the exposure time that was used for capturing the image set.
timeMicrosec | Exposure time measured in microseconds |
Definition at line 499 of file imageset.h.
|
inline |
Sets a new width for both images.
Definition at line 122 of file imageset.h.
void visiontransfer::ImageSet::setIndexOf | ( | ImageType | what, |
int | idx | ||
) |
Assign an image index to a specified ImageType, -1 to disable.
what | The ImageType to assign a new image index to. |
idx | The index of the specified ImageType inside the data of this ImageSet (-1 to disable). |
Definition at line 240 of file imageset.cpp.
|
inline |
Sets the timestamp of the last received sync pulse.
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 520 of file imageset.h.
|
inline |
Sets the number of valid images in this set.
Definition at line 438 of file imageset.h.
|
inline |
Sets the pixel data for the given image.
imageNumber | Number of the image for which to set the pixel data (0 ... getNumberOfImages()-1). |
pixelData | The pixel data that shall be set. |
Definition at line 161 of file imageset.h.
|
inline |
Sets the pixel format for the given image.
imageNumber | Number of the image for which to set the pixel format (0 ... getNumberOfImages()-1). |
format | The pixel format that shall be set. |
Definition at line 143 of file imageset.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 172 of file imageset.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 ... getNumberOfImages()-1). |
stride | The row stride that shall be set. |
Definition at line 131 of file imageset.h.
|
inline |
Sets the sequence number for this image set.
Definition at line 179 of file imageset.h.
|
inline |
Sets the subpixel factor for this image set.
Definition at line 210 of file imageset.h.
|
inline |
Sets the time at which this image set 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 190 of file imageset.h.
|
inline |
Sets a new width for both images.
Definition at line 117 of file imageset.h.
|
inline |
Converts one image of the set to an OpenCV image.
imageNumber | The number of the image that shall be converted (0 ... getNumberOfImages()-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 ImageSet object must be kept alive for as long as the OpenCV image is in use.
Definition at line 39 of file imageset-opencv.h.
void visiontransfer::ImageSet::writePgmFile | ( | int | imageNumber, |
const char * | fileName | ||
) | const |
Writes one image of the set 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 106 of file imageset.cpp.