Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
pcl::DisparityMapConverter< PointT > Class Template Reference

Compute point cloud from the disparity map. More...

#include <pcl/stereo/disparity_map_converter.h>

+ Inheritance diagram for pcl::DisparityMapConverter< PointT >:
+ Collaboration diagram for pcl::DisparityMapConverter< PointT >:

Public Member Functions

 DisparityMapConverter ()
 DisparityMapConverter constructor. More...
 
virtual ~DisparityMapConverter ()
 Empty destructor. More...
 
void setImageCenterX (const float center_x)
 Set x-coordinate of the image center. More...
 
float getImageCenterX () const
 Get x-coordinate of the image center. More...
 
void setImageCenterY (const float center_y)
 Set y-coordinate of the image center. More...
 
float getImageCenterY () const
 Get y-coordinate of the image center. More...
 
void setFocalLength (const float focal_length)
 Set focal length. More...
 
float getFocalLength () const
 Get focal length. More...
 
void setBaseline (const float baseline)
 Set baseline. More...
 
float getBaseline () const
 Get baseline. More...
 
void setDisparityThresholdMin (const float disparity_threshold_min)
 Set min disparity threshold. More...
 
float getDisparityThresholdMin () const
 Get min disparity threshold. More...
 
void setDisparityThresholdMax (const float disparity_threshold_max)
 Set max disparity threshold. More...
 
float getDisparityThresholdMax () const
 Get max disparity threshold. More...
 
void setImage (const pcl::PointCloud< pcl::RGB >::ConstPtr &image)
 Set an image, that will be used for coloring of the output cloud. More...
 
pcl::PointCloud< RGB >::Ptr getImage ()
 Get the image, that is used for coloring of the output cloud. More...
 
bool loadDisparityMap (const std::string &file_name)
 Load the disparity map. More...
 
bool loadDisparityMap (const std::string &file_name, const std::size_t width, const std::size_t height)
 Load the disparity map and initialize it's size. More...
 
void setDisparityMap (const std::vector< float > &disparity_map)
 Set the disparity map. More...
 
void setDisparityMap (const std::vector< float > &disparity_map, const std::size_t width, const std::size_t height)
 Set the disparity map and initialize it's size. More...
 
std::vector< float > getDisparityMap ()
 Get the disparity map. More...
 
virtual void compute (PointCloud &out_cloud)
 Compute the output cloud. More...
 

Protected Types

using PointCloud = pcl::PointCloud< PointT >
 

Protected Member Functions

PointXYZ translateCoordinates (std::size_t row, std::size_t column, float disparity) const
 Translate point from image coordinates and disparity to 3D-coordinates. More...
 

Protected Attributes

float center_x_ {0.0f}
 X-coordinate of the image center. More...
 
float center_y_ {0.0f}
 Y-coordinate of the image center. More...
 
float focal_length_ {0.0f}
 Focal length. More...
 
float baseline_ {0.0f}
 Baseline. More...
 
bool is_color_ {false}
 Is color image is set. More...
 
pcl::PointCloud< pcl::RGB >::ConstPtr image_
 Color image of the scene. More...
 
std::vector< float > disparity_map_
 Vector for the disparity map. More...
 
std::size_t disparity_map_width_ {640}
 X-size of the disparity map. More...
 
std::size_t disparity_map_height_ {480}
 Y-size of the disparity map. More...
 
float disparity_threshold_min_ {0.0f}
 Thresholds of the disparity. More...
 
float disparity_threshold_max_
 

Detailed Description

template<typename PointT>
class pcl::DisparityMapConverter< PointT >

Compute point cloud from the disparity map.

Example of usage:

// Fill left image cloud.
dmc.setBaseline (0.8387445f);
dmc.setFocalLength (368.534700f);
dmc.setImageCenterX (318.112200f);
dmc.setImageCenterY (224.334900f);
// Left view of the scene.
dmc.setImage (left_image);
// Disparity map of the scene.
dmc.loadDisparityMap ("disparity_map.txt", 640, 480);
dmc.compute(*cloud);
Compute point cloud from the disparity map.
void setImage(const pcl::PointCloud< pcl::RGB >::ConstPtr &image)
Set an image, that will be used for coloring of the output cloud.
virtual void compute(PointCloud &out_cloud)
Compute the output cloud.
bool loadDisparityMap(const std::string &file_name)
Load the disparity map.
void setImageCenterX(const float center_x)
Set x-coordinate of the image center.
void setDisparityThresholdMin(const float disparity_threshold_min)
Set min disparity threshold.
void setBaseline(const float baseline)
Set baseline.
void setFocalLength(const float focal_length)
Set focal length.
void setImageCenterY(const float center_y)
Set y-coordinate of the image center.
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:413
Author
Timur Ibadov (ibado.nosp@m.v.ti.nosp@m.mur@g.nosp@m.mail.nosp@m..com)

Definition at line 77 of file disparity_map_converter.h.

Member Typedef Documentation

◆ PointCloud

template<typename PointT >
using pcl::DisparityMapConverter< PointT >::PointCloud = pcl::PointCloud<PointT>
protected

Definition at line 79 of file disparity_map_converter.h.

Constructor & Destructor Documentation

◆ DisparityMapConverter()

DisparityMapConverter constructor.

Definition at line 49 of file disparity_map_converter.hpp.

◆ ~DisparityMapConverter()

template<typename PointT >
pcl::DisparityMapConverter< PointT >::~DisparityMapConverter ( )
virtualdefault

Empty destructor.

Member Function Documentation

◆ compute()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::compute ( PointCloud out_cloud)
virtual

Compute the output cloud.

Parameters
[out]out_cloudthe variable to return the resulting cloud.

Definition at line 238 of file disparity_map_converter.hpp.

References pcl::PointCloud< PointT >::clear(), pcl::PointCloud< PointT >::height, pcl::PointCloud< PointT >::resize(), pcl::common::IntensityFieldAccessor< PointT >::set(), and pcl::PointCloud< PointT >::width.

◆ getBaseline()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getBaseline
inline

Get baseline.

Returns
the baseline.

Definition at line 107 of file disparity_map_converter.hpp.

◆ getDisparityMap()

template<typename PointT >
std::vector< float > pcl::DisparityMapConverter< PointT >::getDisparityMap

Get the disparity map.

Returns
the disparity map.

Definition at line 231 of file disparity_map_converter.hpp.

◆ getDisparityThresholdMax()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getDisparityThresholdMax
inline

Get max disparity threshold.

Returns
max disparity threshold.

Definition at line 137 of file disparity_map_converter.hpp.

◆ getDisparityThresholdMin()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getDisparityThresholdMin
inline

Get min disparity threshold.

Returns
min disparity threshold.

Definition at line 122 of file disparity_map_converter.hpp.

◆ getFocalLength()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getFocalLength
inline

Get focal length.

Returns
the focal length.

Definition at line 93 of file disparity_map_converter.hpp.

◆ getImage()

template<typename PointT >
pcl::PointCloud< pcl::RGB >::Ptr pcl::DisparityMapConverter< PointT >::getImage

Get the image, that is used for coloring of the output cloud.

Returns
the image.

Definition at line 158 of file disparity_map_converter.hpp.

◆ getImageCenterX()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getImageCenterX
inline

Get x-coordinate of the image center.

Returns
x-coordinate of the image center.

Definition at line 65 of file disparity_map_converter.hpp.

◆ getImageCenterY()

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::getImageCenterY
inline

Get y-coordinate of the image center.

Returns
y-coordinate of the image center.

Definition at line 79 of file disparity_map_converter.hpp.

◆ loadDisparityMap() [1/2]

template<typename PointT >
bool pcl::DisparityMapConverter< PointT >::loadDisparityMap ( const std::string &  file_name)

Load the disparity map.

Parameters
[in]file_namethe name of the disparity map file.
Returns
"true" if the disparity map was successfully loaded; "false" otherwise

Definition at line 167 of file disparity_map_converter.hpp.

◆ loadDisparityMap() [2/2]

template<typename PointT >
bool pcl::DisparityMapConverter< PointT >::loadDisparityMap ( const std::string &  file_name,
const std::size_t  width,
const std::size_t  height 
)

Load the disparity map and initialize it's size.

Parameters
[in]file_namethe name of the disparity map file.
[in]widthwidth of the disparity map.
[in]heightheight of the disparity map.
Returns
"true" if the disparity map was successfully loaded; "false" otherwise

Definition at line 196 of file disparity_map_converter.hpp.

◆ setBaseline()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setBaseline ( const float  baseline)
inline

Set baseline.

Parameters
[in]baselinebaseline.

Definition at line 100 of file disparity_map_converter.hpp.

◆ setDisparityMap() [1/2]

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setDisparityMap ( const std::vector< float > &  disparity_map)

Set the disparity map.

Parameters
[in]disparity_mapthe disparity map.

Definition at line 210 of file disparity_map_converter.hpp.

◆ setDisparityMap() [2/2]

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setDisparityMap ( const std::vector< float > &  disparity_map,
const std::size_t  width,
const std::size_t  height 
)

Set the disparity map and initialize it's size.

Parameters
[in]disparity_mapthe disparity map.
[in]widthwidth of the disparity map.
[in]heightheight of the disparity map.
Returns
"true" if the disparity map was successfully loaded; "false" otherwise

Definition at line 218 of file disparity_map_converter.hpp.

◆ setDisparityThresholdMax()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setDisparityThresholdMax ( const float  disparity_threshold_max)
inline

Set max disparity threshold.

Parameters
[in]disparity_threshold_maxmax disparity threshold.

Definition at line 129 of file disparity_map_converter.hpp.

◆ setDisparityThresholdMin()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setDisparityThresholdMin ( const float  disparity_threshold_min)
inline

Set min disparity threshold.

Parameters
[in]disparity_threshold_minmin disparity threshold.

Definition at line 114 of file disparity_map_converter.hpp.

◆ setFocalLength()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setFocalLength ( const float  focal_length)
inline

Set focal length.

Parameters
[in]focal_lengththe focal length.

Definition at line 86 of file disparity_map_converter.hpp.

◆ setImage()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setImage ( const pcl::PointCloud< pcl::RGB >::ConstPtr &  image)

Set an image, that will be used for coloring of the output cloud.

Parameters
[in]imagethe image.

Definition at line 144 of file disparity_map_converter.hpp.

◆ setImageCenterX()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setImageCenterX ( const float  center_x)
inline

Set x-coordinate of the image center.

Parameters
[in]center_xx-coordinate of the image center.

Definition at line 58 of file disparity_map_converter.hpp.

◆ setImageCenterY()

template<typename PointT >
void pcl::DisparityMapConverter< PointT >::setImageCenterY ( const float  center_y)
inline

Set y-coordinate of the image center.

Parameters
[in]center_yy-coordinate of the image center.

Definition at line 72 of file disparity_map_converter.hpp.

◆ translateCoordinates()

template<typename PointT >
pcl::PointXYZ pcl::DisparityMapConverter< PointT >::translateCoordinates ( std::size_t  row,
std::size_t  column,
float  disparity 
) const
protected

Translate point from image coordinates and disparity to 3D-coordinates.

Parameters
[in]row
[in]column
[in]disparity
Returns
the 3D point, that corresponds to the input parameters and the camera calibration.

Definition at line 295 of file disparity_map_converter.hpp.

Member Data Documentation

◆ baseline_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::baseline_ {0.0f}
protected

Baseline.

Definition at line 237 of file disparity_map_converter.h.

◆ center_x_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::center_x_ {0.0f}
protected

X-coordinate of the image center.

Definition at line 231 of file disparity_map_converter.h.

◆ center_y_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::center_y_ {0.0f}
protected

Y-coordinate of the image center.

Definition at line 233 of file disparity_map_converter.h.

◆ disparity_map_

template<typename PointT >
std::vector<float> pcl::DisparityMapConverter< PointT >::disparity_map_
protected

Vector for the disparity map.

Definition at line 245 of file disparity_map_converter.h.

◆ disparity_map_height_

template<typename PointT >
std::size_t pcl::DisparityMapConverter< PointT >::disparity_map_height_ {480}
protected

Y-size of the disparity map.

Definition at line 249 of file disparity_map_converter.h.

◆ disparity_map_width_

template<typename PointT >
std::size_t pcl::DisparityMapConverter< PointT >::disparity_map_width_ {640}
protected

X-size of the disparity map.

Definition at line 247 of file disparity_map_converter.h.

◆ disparity_threshold_max_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::disparity_threshold_max_
protected

Definition at line 253 of file disparity_map_converter.h.

◆ disparity_threshold_min_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::disparity_threshold_min_ {0.0f}
protected

Thresholds of the disparity.

Definition at line 252 of file disparity_map_converter.h.

◆ focal_length_

template<typename PointT >
float pcl::DisparityMapConverter< PointT >::focal_length_ {0.0f}
protected

Focal length.

Definition at line 235 of file disparity_map_converter.h.

◆ image_

template<typename PointT >
pcl::PointCloud<pcl::RGB>::ConstPtr pcl::DisparityMapConverter< PointT >::image_
protected

Color image of the scene.

Definition at line 242 of file disparity_map_converter.h.

◆ is_color_

template<typename PointT >
bool pcl::DisparityMapConverter< PointT >::is_color_ {false}
protected

Is color image is set.

Definition at line 240 of file disparity_map_converter.h.


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