Point Cloud Library (PCL)
1.11.0
|
40 #include <pcl/conversions.h>
55 const auto sad_min_1st_part_it = std::min_element(acc, acc + dbest - 1);
56 const auto sad_min_2nd_part_it = std::min_element(acc + dbest + 2, acc + maxdisp);
58 const auto sad_second_min = std::min(*sad_min_1st_part_it, *sad_min_2nd_part_it);
60 if ((sad_min * precision) > ((precision - ratio_filter) * sad_second_min)) {
75 const auto da_condition = (dbest > 1);
76 const auto db_condition = (dbest < maxdisp - 2);
77 const auto da_index = dbest + 2 - (da_condition << 2);
78 const auto db_index = dbest - 2 + (db_condition << 2);
80 const auto da = acc[da_index] - acc[dbest];
81 const auto db = acc[db_index] - acc[dbest];
82 if ((da + db) < peak_filter) {
123 max_disp_ = max_disp;
146 ratio_filter_ = ratio_filter;
157 peak_filter_ = peak_filter;
168 is_pre_proc_ = is_pre_proc;
181 is_lr_check_ = is_lr_check;
194 lr_check_th_ = lr_check_th;
206 compute(
unsigned char* ref_img,
unsigned char* trg_img,
int width,
int height) = 0;
346 int den = (s1 + s3 - 2 * s2);
348 return (
static_cast<short int>(16 * dbest + (((s1 - s3) * 8) / den)));
349 return (
static_cast<short int>(dbest * 16));
355 float den = (s1 + s3 - 2 * s2);
357 return (
static_cast<short int>(16 * dbest +
358 std::floor(.5 + (((s1 - s3) * 8) / den))));
359 return (
static_cast<short int>(dbest * 16));
388 unsigned char* trg_img,
390 int height)
override;
407 compute_impl(
unsigned char* ref_img,
unsigned char* trg_img)
override = 0;
445 compute_impl(
unsigned char* ref_img,
unsigned char* trg_img)
override;
508 smoothness_weak_ = smoothness_weak;
517 smoothness_strong_ = smoothness_strong;
522 compute_impl(
unsigned char* ref_img,
unsigned char* trg_img)
override;
531 int smoothness_strong_;
532 int smoothness_weak_;
void setLeftRightCheckThreshold(int lr_check_th)
setter for the left-right consistency check threshold
virtual bool getPointCloud(float u_c, float v_c, float focal, float baseline, pcl::PointCloud< pcl::PointXYZRGB >::Ptr cloud, pcl::PointCloud< pcl::RGB >::Ptr texture)
computation of the 3D point cloud from the previously computed disparity map including color informat...
int width_
number of pixels per column of the input stereo pair .
short int computeStereoSubpixel(int dbest, int s1, int s2, int s3)
void imgFlip(unsigned char *&img) override
int ratio_filter_
Threshold for the ratio filter, .
Block based (or fixed window) Stereo Matching class.
void setRatioFilter(int ratio_filter)
setter for the value of the ratio filter
void setSmoothStrong(int smoothness_strong)
"strong" smoothness penalty used within 2-pass Scanline Optimization
void setGammaC(int gamma_c)
setter for the color bandwidth used for cost aggregation based on adaptive weights
void setSmoothWeak(int smoothness_weak)
"weak" smoothness penalty used within 2-pass Scanline Optimization
virtual ~StereoMatching()
int lr_check_th_
Threshold for the left-right consistency check, typically either 0 or 1.
void setXOffset(int x_off)
setter for horizontal offset, i.e.
Stereo Matching abstract class for Grayscale images.
short int doStereoRatioFilter(const T *const acc, short int dbest, T sad_min, int ratio_filter, int maxdisp, int precision=100)
BlockBasedStereoMatching()
~AdaptiveCostSOStereoMatching()
short int * disp_map_trg_
Disparity map used for left-right check.
void setPeakFilter(int peak_filter)
setter for the value of the peak filter
bool is_lr_check_
toggle for the activation of the left-right consistency check stage
virtual void imgFlip(unsigned char *&img)=0
void setGammaS(int gamma_s)
setter for the spatial bandwidth used for cost aggregation based on adaptive weights
void setPreProcessing(bool is_pre_proc)
setter for the pre processing step
Stereo Matching abstract class.
~BlockBasedStereoMatching()
virtual void compute_impl(unsigned char *ref_img, unsigned char *trg_img)=0
void compute(unsigned char *ref_img, unsigned char *trg_img, int width, int height) override
stereo processing, it computes a disparity map stored internally by the class
void medianFilter(int radius)
median filter applied on the previously computed disparity map
int max_disp_
Disparity range used for stereo processing.
void compute_impl(unsigned char *ref_img, unsigned char *trg_img) override=0
bool is_pre_proc_
toggle for the activation of the pre-processing stage
int x_off_
Horizontal displacemente (x offset) used for stereo processing.
AdaptiveCostSOStereoMatching()
virtual void compute(unsigned char *ref_img, unsigned char *trg_img, int width, int height)=0
stereo processing, it computes a disparity map stored internally by the class
void compute(pcl::PointCloud< pcl::RGB > &ref, pcl::PointCloud< pcl::RGB > &trg) override
stereo processing, it computes a disparity map stored internally by the class
void getVisualMap(pcl::PointCloud< pcl::RGB >::Ptr vMap)
computation of a pcl::RGB cloud with scaled disparity values it can be used to display a rescaled ver...
shared_ptr< PointCloud< PointT > > Ptr
unsigned char * pp_trg_img_
void setRadius(int radius)
setter for the radius (half length) of the column used for cost aggregation
virtual void preProcessing(unsigned char *img, unsigned char *pp_img)=0
virtual bool getPointCloud(float u_c, float v_c, float focal, float baseline, pcl::PointCloud< pcl::PointXYZ >::Ptr cloud)
computation of the 3D point cloud from the previously computed disparity map without color informatio...
short int doStereoPeakFilter(const T *const acc, short int dbest, int peak_filter, int maxdisp)
unsigned char * pp_ref_img_
Local aligned copies used for pre processing.
int height_
number of pixels per row of the input stereo pair .
void preProcessing(unsigned char *img, unsigned char *pp_img) override
short int computeStereoSubpixel(int dbest, float s1, float s2, float s3)
void setMaxDisparity(int max_disp)
setter for number of disparity candidates (disparity range)
unsigned char * ref_img_
Local aligned copies of the cloud data.
void setLeftRightCheck(bool is_lr_check)
setter for the left-right consistency check stage, that eliminates inconsistent/wrong disparity value...
virtual void compute(pcl::PointCloud< pcl::RGB > &ref, pcl::PointCloud< pcl::RGB > &trg)=0
stereo processing, it computes a disparity map stored internally by the class
Adaptive Cost 2-pass Scanline Optimization Stereo Matching class.
short int * disp_map_
The internal disparity map.
int peak_filter_
Threshold for the peak filter, .
void setRadius(int radius)
setter for the radius of the squared window