libvisiontransfer
10.8.0
|
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... | |
std::shared_ptr< open3d::geometry::PointCloud > | createOpen3DCloud (const ImageSet &imageSet, ColorSource colSource=COLOR_AUTO, unsigned short minDisparity=0, unsigned short maxDisparity=0xFFF) |
Projects the given disparity map to a Open3D point cloud. More... | |
std::shared_ptr< open3d::geometry::RGBDImage > | createOpen3DImageRGBD (const ImageSet &imageSet, ColorSource colSource=COLOR_AUTO, unsigned short minDisparity=0) |
Converts the given disparity map to a Open3D RGBDn image. More... | |
Source channel selection for color information.
Definition at line 65 of file reconstruct3d.h.
visiontransfer::Reconstruct3D::Reconstruct3D | ( | ) |
Constructs a new object for 3D reconstructing.
Definition at line 89 of file reconstruct3d.cpp.
|
inline |
Projects the given disparity map to a Open3D point cloud.
imageSet | Image set containing the disparity map. |
colSource | Source channel of the color information |
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. |
For this method to be available, the Open3d 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 39 of file reconstruct3d-open3d.h.
|
inline |
Converts the given disparity map to a Open3D RGBDn image.
imageSet | Image set containing the disparity map. |
minDisparity | The minimum disparity with N-bit subpixel resolution. |
For this method to be available, the Open3d 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 100 of file reconstruct3d-open3d.h.
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.
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 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 97 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 56 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 64 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 107 of file reconstruct3d-pcl.h.
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.
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 108 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 113 of file reconstruct3d.cpp.
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.
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. |
colSource | Source channel of the color information |
maxDisparity | The maximum value that occurs in the disparity map. Any value greater or equal will be marked as invalid. |
Definition at line 119 of file reconstruct3d.cpp.