37#ifndef PCL_DISPARITY_MAP_CONVERTER_IMPL_H_
38#define PCL_DISPARITY_MAP_CONVERTER_IMPL_H_
40#include <pcl/common/intensity.h>
41#include <pcl/console/print.h>
42#include <pcl/stereo/disparity_map_converter.h>
48template <
typename Po
intT>
55, disparity_map_width_(640)
56, disparity_map_height_(480)
57, disparity_threshold_min_(0.0f)
61template <
typename Po
intT>
65template <
typename Po
intT>
72template <
typename Po
intT>
79template <
typename Po
intT>
86template <
typename Po
intT>
93template <
typename Po
intT>
97 focal_length_ = focal_length;
100template <
typename Po
intT>
104 return focal_length_;
107template <
typename Po
intT>
111 baseline_ = baseline;
114template <
typename Po
intT>
121template <
typename Po
intT>
129template <
typename Po
intT>
133 return disparity_threshold_min_;
136template <
typename Po
intT>
144template <
typename Po
intT>
148 return disparity_threshold_max_;
151template <
typename Po
intT>
159 disparity_map_width_ = image_->width;
160 disparity_map_height_ = image_->height;
165template <
typename Po
intT>
174template <
typename Po
intT>
183 PCL_ERROR(
"[pcl::DisparityMapConverter::loadDisparityMap] Can't load the file.\n");
188 disparity_map_.resize(disparity_map_width_ * disparity_map_height_);
191 for (std::size_t
row = 0;
row < disparity_map_height_; ++
row) {
203template <
typename Po
intT>
206 const std::size_t width,
207 const std::size_t height)
210 disparity_map_width_ = width;
211 disparity_map_height_ = height;
214 return loadDisparityMap(file_name);
217template <
typename Po
intT>
225template <
typename Po
intT>
229 const std::size_t width,
230 const std::size_t height)
232 disparity_map_width_ = width;
233 disparity_map_height_ = height;
238template <
typename Po
intT>
242 return disparity_map_;
245template <
typename Po
intT>
252 out_cloud.height = disparity_map_height_;
255 if (is_color_ && !image_) {
256 PCL_ERROR(
"[pcl::DisparityMapConverter::compute] Memory for the image was not "
261 for (std::size_t
row = 0;
row < disparity_map_height_; ++
row) {
283 if (disparity_threshold_min_ <
disparity &&
292 new_point.x = std::numeric_limits<float>::quiet_NaN();
293 new_point.y = std::numeric_limits<float>::quiet_NaN();
294 new_point.z = std::numeric_limits<float>::quiet_NaN();
302template <
typename Po
intT>
323#define PCL_INSTANTIATE_DisparityMapConverter(T) \
324 template class PCL_EXPORTS pcl::DisparityMapConverter<T>;
Iterator class for point clouds with or without given indices.
float getBaseline() const
Get baseline.
std::vector< float > getDisparityMap()
Get the disparity map.
float getImageCenterY() const
Get y-coordinate of the image center.
void setDisparityThresholdMax(const float disparity_threshold_max)
Set max disparity threshold.
float getImageCenterX() const
Get x-coordinate of the image center.
void setImage(const pcl::PointCloud< pcl::RGB >::ConstPtr &image)
Set an image, that will be used for coloring of the output cloud.
PointXYZ translateCoordinates(std::size_t row, std::size_t column, float disparity) const
Translate point from image coordinates and disparity to 3D-coordinates.
pcl::PointCloud< RGB >::Ptr getImage()
Get the image, that is 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.
virtual ~DisparityMapConverter()
Empty destructor.
DisparityMapConverter()
DisparityMapConverter constructor.
void setDisparityMap(const std::vector< float > &disparity_map)
Set the disparity map.
void setDisparityThresholdMin(const float disparity_threshold_min)
Set min disparity threshold.
float getDisparityThresholdMax() const
Get max disparity threshold.
float getDisparityThresholdMin() const
Get min disparity threshold.
void setBaseline(const float baseline)
Set baseline.
float getFocalLength() const
Get focal length.
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
shared_ptr< const PointCloud< PointT > > ConstPtr
Defines all the PCL implemented PointT point type structures.
A point structure representing Euclidean xyz coordinates.
A point structure representing Euclidean xyz coordinates, and the RGB color.