libvisiontransfer  10.6.0
Classes | Public Types | Public Member Functions | List of all members
visiontransfer::Reconstruct3D Class Reference

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 47 of file reconstruct3d.h.

#include <visiontransfer/reconstruct3d.h>

Classes

class  Pimpl
 

Public Types

enum  ColorSource { COLOR_NONE, COLOR_AUTO, COLOR_LEFT, COLOR_THIRD_COLOR }
 Source channel selection for color information. More...
 

Public Member Functions

 Reconstruct3D ()
 Constructs a new object for 3D reconstructing. More...
 
float * createPointMap (const ImageSet &imageSet, unsigned short minDisparity=0, unsigned short maxDisparity=0xFFF)
 Reconstructs the 3D location of each pixel in the given disparity map. More...
 
float * createZMap (const ImageSet &imageSet, unsigned short minDisparity=0, unsigned short maxDisparity=0xFFF)
 Converts the disparity 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, ColorSource colSource=COLOR_AUTO, unsigned short maxDisparity=0xFFF)
 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...
 

Member Enumeration Documentation

◆ ColorSource

Source channel selection for color information.

Enumerator
COLOR_NONE 

Omit color information.

COLOR_AUTO 

Automatically choose the best color channel.

COLOR_LEFT 

Copy color data from left camera.

COLOR_THIRD_COLOR 

Copy color data from 3rd color camera.

Definition at line 65 of file reconstruct3d.h.

Constructor & Destructor Documentation

◆ Reconstruct3D()

visiontransfer::Reconstruct3D::Reconstruct3D ( )

Constructs a new object for 3D reconstructing.

Definition at line 83 of file reconstruct3d.cpp.

Member Function Documentation

◆ createPointMap()

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

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.
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 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 91 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 56 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 64 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 107 of file reconstruct3d-pcl.h.

◆ createZMap()

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

Converts the disparity 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 102 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 107 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,
ColorSource  colSource = COLOR_AUTO,
unsigned short  maxDisparity = 0xFFF 
)

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.
colSourceSource channel of the color information
maxDisparityThe maximum value that occurs in the disparity map. Any value greater or equal will be marked as invalid.

Definition at line 113 of file reconstruct3d.cpp.


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