libvisiontransfer  4.1.5
Classes | Public Member Functions | List of all members
Reconstruct3D Class Reference

Transforms a disparity map into a set of 3D points. More...

#include <visiontransfer/reconstruct3d.h>

Classes

class  Pimpl
 

Public Member Functions

 Reconstruct3D ()
 Constructs a new object for 3D reconstructing. More...
 
float * createPointMap (const unsigned short *dispMap, int width, int height, int rowStride, const float *q, unsigned short minDisparity=1)
 Reconstructs the 3D location of each pixel in the given disparity map. More...
 
float * createPointMap (const ImagePair &imagePair, unsigned short minDisparity=1)
 Reconstructs the 3D location of each pixel in the given disparity map. More...
 
void writePlyFile (const char *file, const unsigned short *dispMap, const unsigned char *image, int width, int height, int dispRowStride, int imageRowStride, const float *q, double maxZ=std::numeric_limits< double >::max())
 Projects the given disparity map to 3D points and exports the result to a PLY file. More...
 
void writePlyFile (const char *file, const ImagePair &imagePair, double maxZ=std::numeric_limits< double >::max())
 Projects the given disparity map to 3D points and exports the result to a PLY file. More...
 

Detailed Description

Transforms a disparity map into a set of 3D points.

Use this class for reconstructing the 3D location for each valid point in a disparity map.

Definition at line 28 of file reconstruct3d.h.

Constructor & Destructor Documentation

Reconstruct3D::Reconstruct3D ( )

Constructs a new object for 3D reconstructing.

Definition at line 66 of file reconstruct3d.cpp.

Member Function Documentation

float * Reconstruct3D::createPointMap ( const unsigned short *  dispMap,
int  width,
int  height,
int  rowStride,
const float *  q,
unsigned short  minDisparity = 1 
)

Reconstructs the 3D location of each pixel in the given disparity map.

Parameters
dispMapPointer to the data of the disparity map. The disparity map is assumed to have a 4-bit subpixel resolution. This means that each value needs to be divided by 16 to receive the true disparity.
widthWidth of the disparity map.
heightHeight of the disparity map.
rowStrideRow stride (i.e. distance between two rows in bytes) of the disparity map.
qDisparity-to-depth mapping matrix of size 4x4. The matrix is stored in a row-wise alignment. Obtain this matrix from your camera calibration data.
minDisparityThe minimum disparity, again with 4-bit subpixel resolution. Lower disparities will be clamped to this value before computing the 3D location.

The output map will have a size of exactly 4*width*height float values. For each point the x, y and z coordinates are stored consecutively, plus one additional float (four bytes) as padding. Invalid disparities will be set to the given minimum disparity.

If the minimum disparity is set to 0, points with a disparity of 0 or an invalid disparity will receive a z coordinate of +inf.

The returned point map is valid until the next call of createPointMap() or writePlyFile().

Definition at line 74 of file reconstruct3d.cpp.

float * Reconstruct3D::createPointMap ( const ImagePair imagePair,
unsigned short  minDisparity = 1 
)

Reconstructs the 3D location of each pixel in the given disparity map.

Parameters
imagePairImage pair containing the disparity map.
minDisparityThe minimum disparity with 4-bit subpixel resolution.

The second image in imagePair is interpreted as the disparity map.

Please see createPointMap(const unsigned short*, int, int, int, const float*, unsigned short) for further details.

Definition at line 79 of file reconstruct3d.cpp.

void Reconstruct3D::writePlyFile ( const char *  file,
const unsigned short *  dispMap,
const unsigned char *  image,
int  width,
int  height,
int  dispRowStride,
int  imageRowStride,
const float *  q,
double  maxZ = std::numeric_limits<double>::max() 
)

Projects the given disparity map to 3D points and exports the result to a PLY file.

Parameters
fileThe output file
dispMapPointer to the data of the disparity map. The disparity map is assumed to have a 4-bit subpixel resolution. This means that each value needs to be divided by 16 to receive the true disparity.
leftRectified left input image in 8-bit gray scale format.
widthWidth of the disparity map and left image.
heightHeight of the disparity map and left image.
dispRowStrideRow stride (i.e. distance between two rows in bytes) of the disparity map.
imageRowStrideRow stride (i.e. distance between two rows in bytes) of the left image.
qDisparity-to-depth mapping matrix of size 4x4. The matrix is stored in a row-wise alignment. Obtain this matrix from your camera calibration data.
maxZMaximum allowed z-coordinate. Points with a higher z-coordinate are not exported.

The left image has to be provided for assigning a color to each point.

Definition at line 83 of file reconstruct3d.cpp.

void Reconstruct3D::writePlyFile ( const char *  file,
const ImagePair imagePair,
double  maxZ = std::numeric_limits<double>::max() 
)

Projects the given disparity map to 3D points and exports the result to a PLY file.

Parameters
imagePairImage pair containing camera image and disparity map.
maxZMaximum allowed z-coordinate.

The first image in imagePair is interpreted as camera image and the second image as disparity map.

Please see writePlyFile(const char*, const unsigned short*, const unsigned char*, int, int, int, int, const float*, double) for further details.

Definition at line 90 of file reconstruct3d.cpp.


The documentation for this class was generated from the following files:
Nerian Vision Technologies