libvisiontransfer
10.0.0
|
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... | |
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.
visiontransfer::Reconstruct3D::Reconstruct3D | ( | ) |
Constructs a new object for 3D reconstructing.
Definition at line 80 of file reconstruct3d.cpp.
float * visiontransfer::Reconstruct3D::createPointMap | ( | const ImageSet & | imageSet, |
unsigned short | minDisparity = 1 |
||
) |
Reconstructs the 3D location of each pixel in the given disparity map.
imageSet | Image set containing the disparity map. |
minDisparity | The 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.
|
inline |
Projects the given disparity map to a PCL point cloud without pixel intensities.
imageSet | Image set containing the disparity map. |
frameId | Frame ID that will be assigned to the created point cloud. |
minDisparity | The 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.
|
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.
|
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.
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.
imageSet | Image set containing the disparity map. |
minDisparity | The minimum disparity with N-bit subpixel resolution. |
maxDisparity | The 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.
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.
imageX | X component of the image location. |
imageY | Y component of the image location. |
disparity | Value 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. |
q | Disparity-to-depth mapping matrix of size 4x4. The matrix is stored in a row-wise alignment. Obtain this matrix from your camera calibration data. |
pointX | Destination variable for the 3D point X component. |
pointY | Destination variable for the 3D point Y component. |
pointZ | Destination variable for the 3D point Z component. |
subpixelFactor | Subpixel 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.
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.
file | The name for the output file. |
imageSet | Image set containing camera image and disparity map. |
maxZ | Maximum allowed z-coordinate. |
binary | Specifies whether the ASCII or binary PLY-format should be used. |
Definition at line 110 of file reconstruct3d.cpp.