Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
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.
virtual ~DisparityMapConverter ()
 Empty destructor.
void setImageCenterX (const float center_x)
 Set x-coordinate of the image center.
float getImageCenterX () const
 Get x-coordinate of the image center.
void setImageCenterY (const float center_y)
 Set y-coordinate of the image center.
float getImageCenterY () const
 Get y-coordinate of the image center.
void setFocalLength (const float focal_length)
 Set focal length.
float getFocalLength () const
 Get focal length.
void setBaseline (const float baseline)
 Set baseline.
float getBaseline () const
 Get baseline.
void setDisparityThresholdMin (const float disparity_threshold_min)
 Set min disparity threshold.
float getDisparityThresholdMin () const
 Get min disparity threshold.
void setDisparityThresholdMax (const float disparity_threshold_max)
 Set max disparity threshold.
float getDisparityThresholdMax () const
 Get max disparity threshold.
void setImage (const pcl::PointCloud< pcl::RGB >::ConstPtr &image)
 Set an image, that will be used for coloring of the output cloud.
pcl::PointCloud< RGB >::Ptr getImage ()
 Get the image, that is used for coloring of the output cloud.
bool loadDisparityMap (const std::string &file_name)
 Load the disparity map.
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.
void setDisparityMap (const std::vector< float > &disparity_map)
 Set the disparity map.
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.
std::vector< float > getDisparityMap ()
 Get the disparity map.
virtual void compute (PointCloud &out_cloud)
 Compute the output cloud.

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.

Protected Attributes

float center_x_ {0.0f}
 X-coordinate of the image center.
float center_y_ {0.0f}
 Y-coordinate of the image center.
float focal_length_ {0.0f}
 Focal length.
float baseline_ {0.0f}
 Baseline.
bool is_color_ {false}
 Is color image is set.
pcl::PointCloud< pcl::RGB >::ConstPtr image_
 Color image of the scene.
std::vector< float > disparity_map_
 Vector for the disparity map.
std::size_t disparity_map_width_ {640}
 X-size of the disparity map.
std::size_t disparity_map_height_ {480}
 Y-size of the disparity map.
float disparity_threshold_min_ {0.0f}
 Thresholds of the disparity.
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.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
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

Definition at line 79 of file disparity_map_converter.h.

Constructor & Destructor Documentation

◆ DisparityMapConverter()

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

DisparityMapConverter constructor.

Definition at line 49 of file disparity_map_converter.hpp.

References disparity_threshold_max_.

◆ ~DisparityMapConverter()

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

Empty destructor.

Member Function Documentation

◆ compute()

◆ getBaseline()

template<typename PointT>
float pcl::DisparityMapConverter< PointT >::getBaseline ( ) const
inline

Get baseline.

Returns
the baseline.

Definition at line 107 of file disparity_map_converter.hpp.

References baseline_.

◆ 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.

References disparity_map_.

◆ getDisparityThresholdMax()

template<typename PointT>
float pcl::DisparityMapConverter< PointT >::getDisparityThresholdMax ( ) const
inline

Get max disparity threshold.

Returns
max disparity threshold.

Definition at line 137 of file disparity_map_converter.hpp.

References disparity_threshold_max_.

◆ getDisparityThresholdMin()

template<typename PointT>
float pcl::DisparityMapConverter< PointT >::getDisparityThresholdMin ( ) const
inline

Get min disparity threshold.

Returns
min disparity threshold.

Definition at line 122 of file disparity_map_converter.hpp.

References disparity_threshold_min_.

◆ getFocalLength()

template<typename PointT>
float pcl::DisparityMapConverter< PointT >::getFocalLength ( ) const
inline

Get focal length.

Returns
the focal length.

Definition at line 93 of file disparity_map_converter.hpp.

References focal_length_.

◆ 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 ( ) const
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.

References center_x_.

◆ getImageCenterY()

template<typename PointT>
float pcl::DisparityMapConverter< PointT >::getImageCenterY ( ) const
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.

References center_y_.

◆ 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.

Referenced by loadDisparityMap().

◆ 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.

References disparity_map_height_, disparity_map_width_, and loadDisparityMap().

◆ 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.

References baseline_.

◆ 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.

References disparity_map_, disparity_map_height_, and disparity_map_width_.

◆ 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.

References disparity_threshold_max_.

◆ 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.

References focal_length_.

◆ 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.

References center_x_.

◆ 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.

References center_y_.

◆ 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.

References baseline_, center_x_, center_y_, and focal_length_.

Referenced by compute().

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.

Referenced by getBaseline(), setBaseline(), and translateCoordinates().

◆ 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.

Referenced by getImageCenterX(), setImageCenterX(), and translateCoordinates().

◆ 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.

Referenced by getImageCenterY(), setImageCenterY(), and translateCoordinates().

◆ 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.

Referenced by compute(), getDisparityMap(), and setDisparityMap().

◆ 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.

Referenced by compute(), loadDisparityMap(), and setDisparityMap().

◆ 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.

Referenced by compute(), loadDisparityMap(), and setDisparityMap().

◆ disparity_threshold_max_

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

◆ 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.

Referenced by compute(), and getDisparityThresholdMin().

◆ 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.

Referenced by getFocalLength(), setFocalLength(), and translateCoordinates().

◆ 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.

Referenced by compute().

◆ 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.

Referenced by compute().


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