15 #ifndef VISIONTRANSFER_IMAGESET_H 16 #define VISIONTRANSFER_IMAGESET_H 20 #include "visiontransfer/common.h" 40 static const int MAX_SUPPORTED_IMAGES = 3;
60 FORMAT_8_BIT = FORMAT_8_BIT_MONO,
61 FORMAT_12_BIT = FORMAT_12_BIT_MONO
105 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
106 rowStride[imageNumber] = stride;
117 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
118 formats[imageNumber] = format;
121 #ifndef DOXYGEN_SHOULD_SKIP_THIS 122 DEPRECATED(
"Use setPixelFormat(int, ImageFormat) instead")
void setPixelFormat(
int imageNumber,
ImageFormat_Deprecated format) {
123 setPixelFormat(imageNumber, static_cast<ImageFormat>(format));
135 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
136 data[imageNumber] = pixelData;
165 timeMicrosec = microsec;
176 minDisparity = minimum;
177 maxDisparity = maximum;
184 subpixelFactor = subpixFact;
194 DEPRECATED(
"Only compatible with two-image sets: use setNumberOfImages() and setIndexOf() instead")
195 void setImageDisparityPair(
bool dispPair);
217 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
218 return rowStride[imageNumber];
230 int idx = getIndexOf(what,
true);
231 return getRowStride(idx);
244 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
245 return formats[imageNumber];
257 int idx = getIndexOf(what,
true);
258 return getPixelFormat(idx);
271 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
272 return data[imageNumber];
284 int idx = getIndexOf(what,
true);
285 return getPixelData(idx);
309 microsec = timeMicrosec;
321 minimum = minDisparity;
322 maximum = maxDisparity;
329 return subpixelFactor;
338 void writePgmFile(
int imageNumber,
const char* fileName)
const;
352 DEPRECATED(
"Only compatible with two-image sets: use hasImageType(ImageSet::IMAGE_DISPARITY) instead")
353 bool isImageDisparityPair()
const {
354 return (getNumberOfImages()==2) && hasImageType(IMAGE_DISPARITY);
369 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
370 return getBytesPerPixel(formats[imageNumber]);
380 assert(imageNumber >= 0 && imageNumber < getNumberOfImages());
381 return getBitsPerPixel(formats[imageNumber]);
384 int getBitsPerPixel(
ImageType what)
const {
385 int idx = getIndexOf(what,
true);
386 return getBitsPerPixel(idx);
401 return numberOfImages;
408 assert(number >= 1 && number <= MAX_SUPPORTED_IMAGES);
409 numberOfImages = number;
415 ImageType getImageType(
int imageNumber)
const;
425 int getIndexOf(
ImageType what,
bool throwIfNotFound=
false)
const;
431 return getIndexOf(what) >= 0;
442 void setIndexOf(
ImageType what,
int idx);
445 #ifdef CV_MAJOR_VERSION 460 inline void toOpenCVImage(
int imageNumber, cv::Mat& dest,
bool convertRgbToBgr =
true);
467 int rowStride[MAX_SUPPORTED_IMAGES];
469 unsigned char* data[MAX_SUPPORTED_IMAGES];
470 const float* qMatrix;
477 int* referenceCounter;
482 int indexDisparityImage;
485 void decrementReference();
494 #include "visiontransfer/imageset-opencv.h"
void setNumberOfImages(int number)
Sets the number of valid images in this set.
int getRowStride(int imageNumber) const
Returns the row stride for the pixel data of one image.
void setTimestamp(int seconds, int microsec)
Sets the time at which this image set has been captured.
void setPixelData(int imageNumber, unsigned char *pixelData)
Sets the pixel data for the given image.
void getTimestamp(int &seconds, int µsec) const
Returns the time at which this image set has been captured.
const float * getQMatrix() const
Returns a pointer to the disparity-to-depth mapping matrix q.
void setWidth(int w)
Sets a new width for both images.
int getBitsPerPixel(int imageNumber) const
Returns the number of bits that are required to store one image pixel.
int getNumberOfImages() const
Returns the number of images in this set.
unsigned int getSequenceNumber() const
Returns the sequence number for this image set.
void setSequenceNumber(unsigned int num)
Sets the sequence number for this image set.
int getHeight() const
Returns the height of each image.
void setHeight(int h)
Sets a new width for both images.
unsigned char * getPixelData(ImageType what) const
Returns the pixel data for the given image.
int getBytesPerPixel(int imageNumber) const
Returns the number of bytes that are required to store one image pixel.
int getSubpixelFactor() const
Gets the subpixel factor for this image set.
void setPixelFormat(int imageNumber, ImageFormat format)
Sets the pixel format for the given image.
void setRowStride(int imageNumber, int stride)
Sets a new row stride for the pixel data of one image.
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 con...
ImageType
Supported image types.
ImageFormat
Image formats that can be transferred.
unsigned char * getPixelData(int imageNumber) const
Returns the pixel data for the given image.
bool hasImageType(ImageType what) const
Returns whether a left camera image is included in the enabled data.
A set of one to three images, but usually two (the left camera image and the disparity map)...
ImageFormat getPixelFormat(int imageNumber) const
Returns the pixel format for the given image.
int getRowStride(ImageType what) const
Returns the row stride for the pixel data of one image.
ImageFormat getPixelFormat(ImageType what) const
Returns the pixel format for the given image.
void setDisparityRange(int minimum, int maximum)
Sets the value range for the disparity map contained in this image set.
int getWidth() const
Returns the width of each image.
void setSubpixelFactor(int subpixFact)
Sets the subpixel factor for this image set.
void setQMatrix(const float *q)
Sets the pointer to the disparity-to-depth mapping matrix q.