libvisiontransfer  9.0.3
Classes | Public Member Functions | List of all members
visiontransfer::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 ImageSet &imageSet, unsigned short minDisparity=1)
 Reconstructs the 3D location of each pixel in the given disparity map. More...
 
float * createZMap (const ImageSet &imageSet, unsigned short minDisparity=1, unsigned short maxDisparity=0xFFF)
 Converts the disparit in an image set to a depth map. More...
 
void projectSinglePoint (int imageX, int imageY, unsigned short disparity, const float *q, float &pointX, float &pointY, float &pointZ, int subpixelFactor=16)
 Reconstructs the 3D location of one individual point. More...
 
void writePlyFile (const char *file, const ImageSet &imageSet, double maxZ=std::numeric_limits< double >::max(), bool binary=false)
 Projects the given disparity map to 3D points and exports the result to a PLY file. More...
 
pcl::PointCloud< pcl::PointXYZ >::Ptr createXYZCloud (const ImageSet &imageSet, const char *frameId, unsigned short minDisparity=0)
 Projects the given disparity map to a PCL point cloud without pixel intensities. More...
 
pcl::PointCloud< pcl::PointXYZI >::Ptr createXYZICloud (const ImageSet &imageSet, const char *frameId, unsigned short minDisparity=0)
 Projects the given disparity map to a PCL point cloud, including pixel intensities. More...
 
pcl::PointCloud< pcl::PointXYZRGB >::Ptr createXYZRGBCloud (const ImageSet &imageSet, const char *frameId, unsigned short minDisparity=0)
 Projects the given disparity map to a PCL point cloud, including pixel RGB data. 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 35 of file reconstruct3d.h.

Constructor & Destructor Documentation

◆ Reconstruct3D()

visiontransfer::Reconstruct3D::Reconstruct3D ( )

Constructs a new object for 3D reconstructing.

Definition at line 80 of file reconstruct3d.cpp.

Member Function Documentation

◆ createPointMap()

float * visiontransfer::Reconstruct3D::createPointMap ( const ImageSet imageSet,
unsigned short  minDisparity = 1 
)

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

Parameters
imageSetImage set containing the disparity map.
minDisparityThe minimum disparity with N-bit subpixel resolution.

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. If a larger minimum disparity is given, points with a lower disparity will be at a fix depth that corresponds to this disparity.

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

Definition at line 88 of file reconstruct3d.cpp.

◆ createXYZCloud()

pcl::PointCloud< pcl::PointXYZ >::Ptr visiontransfer::Reconstruct3D::createXYZCloud ( const ImageSet imageSet,
const char *  frameId,
unsigned short  minDisparity = 0 
)
inline

Projects the given disparity map to a PCL point cloud without pixel intensities.

Parameters
imageSetImage set containing the disparity map.
frameIdFrame ID that will be assigned to the created point cloud.
minDisparityThe minimum disparity with N-bit subpixel resolution.

For this method to be available, the PCL headers must be included before the libvisiontransfer headers!

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. If a larger minimum disparity is given, points with a lower disparity will be at a fix depth that corresponds to this disparity.

Definition at line 44 of file reconstruct3d-pcl.h.

◆ createXYZICloud()

pcl::PointCloud< pcl::PointXYZI >::Ptr visiontransfer::Reconstruct3D::createXYZICloud ( const ImageSet imageSet,
const char *  frameId,
unsigned short  minDisparity = 0 
)
inline

Projects the given disparity map to a PCL point cloud, including pixel intensities.

See createXYZCloud() for details.

Definition at line 52 of file reconstruct3d-pcl.h.

◆ createXYZRGBCloud()

pcl::PointCloud< pcl::PointXYZRGB >::Ptr visiontransfer::Reconstruct3D::createXYZRGBCloud ( const ImageSet imageSet,
const char *  frameId,
unsigned short  minDisparity = 0 
)
inline

Projects the given disparity map to a PCL point cloud, including pixel RGB data.

See createXYZCloud() for details.

Definition at line 93 of file reconstruct3d-pcl.h.

◆ createZMap()

float * visiontransfer::Reconstruct3D::createZMap ( const ImageSet imageSet,
unsigned short  minDisparity = 1,
unsigned short  maxDisparity = 0xFFF 
)

Converts the disparit in an image set to a depth map.

Parameters
imageSetImage set containing the disparity map.
minDisparityThe minimum disparity with N-bit subpixel resolution.
maxDisparityThe maximum value that occurs in the disparity map. Any value greater or equal will be marked as invalid.

The output map will have a size of exactly width*height float values. Each value represents the depth at the given pixel coordinate in meters.

This method is closely related to createPointMap(). It only computes the Z coordinates, whereas createPointMap() also computes X and Y coordinates for each image point.

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. If a larger minimum disparity is given, points with a lower disparity will be at a fix depth that corresponds to this disparity.

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

Definition at line 99 of file reconstruct3d.cpp.

◆ projectSinglePoint()

void visiontransfer::Reconstruct3D::projectSinglePoint ( int  imageX,
int  imageY,
unsigned short  disparity,
const float *  q,
float &  pointX,
float &  pointY,
float &  pointZ,
int  subpixelFactor = 16 
)

Reconstructs the 3D location of one individual point.

Parameters
imageXX component of the image location.
imageYY component of the image location.
disparityValue of the disparity map at the image location. It is assumed that the lower N bits are the fractional component. This means that each value needs to be divided by a subpixel factor to receive the true disparity.
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.
pointXDestination variable for the 3D point X component.
pointYDestination variable for the 3D point Y component.
pointZDestination variable for the 3D point Z component.
subpixelFactorSubpixel division factor for disparity value.

This method projects a single point from a disparity map to a 3D location. If the 3D coordinates of multiple points are of interest, createPointMap() should be used for best performance.

Definition at line 104 of file reconstruct3d.cpp.

◆ writePlyFile()

void visiontransfer::Reconstruct3D::writePlyFile ( const char *  file,
const ImageSet imageSet,
double  maxZ = std::numeric_limits<double>::max(),
bool  binary = false 
)

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

Parameters
fileThe name for the output file.
imageSetImage set containing camera image and disparity map.
maxZMaximum allowed z-coordinate.
binarySpecifies whether the ASCII or binary PLY-format should be used.

Definition at line 110 of file reconstruct3d.cpp.


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