add plc 1.10 lib for x86 cpu
This commit is contained in:
BIN
deps_install/bin/pcl_add_gaussian_noise
Executable file
BIN
deps_install/bin/pcl_add_gaussian_noise
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_boundary_estimation
Executable file
BIN
deps_install/bin/pcl_boundary_estimation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_cluster_extraction
Executable file
BIN
deps_install/bin/pcl_cluster_extraction
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_compute_cloud_error
Executable file
BIN
deps_install/bin/pcl_compute_cloud_error
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_compute_hausdorff
Executable file
BIN
deps_install/bin/pcl_compute_hausdorff
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_compute_hull
Executable file
BIN
deps_install/bin/pcl_compute_hull
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_concatenate_points_pcd
Executable file
BIN
deps_install/bin/pcl_concatenate_points_pcd
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_convert_pcd_ascii_binary
Executable file
BIN
deps_install/bin/pcl_convert_pcd_ascii_binary
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_crf_segmentation
Executable file
BIN
deps_install/bin/pcl_crf_segmentation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_crop_to_hull
Executable file
BIN
deps_install/bin/pcl_crop_to_hull
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_demean_cloud
Executable file
BIN
deps_install/bin/pcl_demean_cloud
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_elch
Executable file
BIN
deps_install/bin/pcl_elch
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_extract_feature
Executable file
BIN
deps_install/bin/pcl_extract_feature
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_fast_bilateral_filter
Executable file
BIN
deps_install/bin/pcl_fast_bilateral_filter
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_fpfh_estimation
Executable file
BIN
deps_install/bin/pcl_fpfh_estimation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_generate
Executable file
BIN
deps_install/bin/pcl_generate
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_gp3_surface
Executable file
BIN
deps_install/bin/pcl_gp3_surface
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_grid_min
Executable file
BIN
deps_install/bin/pcl_grid_min
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_hdl_grabber
Executable file
BIN
deps_install/bin/pcl_hdl_grabber
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_icp
Executable file
BIN
deps_install/bin/pcl_icp
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_icp2d
Executable file
BIN
deps_install/bin/pcl_icp2d
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_linemod_detection
Executable file
BIN
deps_install/bin/pcl_linemod_detection
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_local_max
Executable file
BIN
deps_install/bin/pcl_local_max
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_lum
Executable file
BIN
deps_install/bin/pcl_lum
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_marching_cubes_reconstruction
Executable file
BIN
deps_install/bin/pcl_marching_cubes_reconstruction
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_match_linemod_template
Executable file
BIN
deps_install/bin/pcl_match_linemod_template
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_mls_smoothing
Executable file
BIN
deps_install/bin/pcl_mls_smoothing
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_morph
Executable file
BIN
deps_install/bin/pcl_morph
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ndt2d
Executable file
BIN
deps_install/bin/pcl_ndt2d
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ndt3d
Executable file
BIN
deps_install/bin/pcl_ndt3d
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_normal_estimation
Executable file
BIN
deps_install/bin/pcl_normal_estimation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_oni2pcd
Executable file
BIN
deps_install/bin/pcl_oni2pcd
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_openni_grabber_depth_example
Executable file
BIN
deps_install/bin/pcl_openni_grabber_depth_example
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_openni_grabber_example
Executable file
BIN
deps_install/bin/pcl_openni_grabber_example
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_openni_pcd_recorder
Executable file
BIN
deps_install/bin/pcl_openni_pcd_recorder
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_outlier_removal
Executable file
BIN
deps_install/bin/pcl_outlier_removal
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_passthrough_filter
Executable file
BIN
deps_install/bin/pcl_passthrough_filter
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pcd2ply
Executable file
BIN
deps_install/bin/pcl_pcd2ply
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pcd2vtk
Executable file
BIN
deps_install/bin/pcl_pcd2vtk
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pcd_change_viewpoint
Executable file
BIN
deps_install/bin/pcl_pcd_change_viewpoint
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pcd_convert_NaN_nan
Executable file
BIN
deps_install/bin/pcl_pcd_convert_NaN_nan
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pcd_introduce_nan
Executable file
BIN
deps_install/bin/pcl_pcd_introduce_nan
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_pclzf2pcd
Executable file
BIN
deps_install/bin/pcl_pclzf2pcd
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_plane_projection
Executable file
BIN
deps_install/bin/pcl_plane_projection
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ply2obj
Executable file
BIN
deps_install/bin/pcl_ply2obj
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ply2pcd
Executable file
BIN
deps_install/bin/pcl_ply2pcd
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ply2ply
Executable file
BIN
deps_install/bin/pcl_ply2ply
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_ply2raw
Executable file
BIN
deps_install/bin/pcl_ply2raw
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_plyheader
Executable file
BIN
deps_install/bin/pcl_plyheader
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_poisson_reconstruction
Executable file
BIN
deps_install/bin/pcl_poisson_reconstruction
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_progressive_morphological_filter
Executable file
BIN
deps_install/bin/pcl_progressive_morphological_filter
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_radius_filter
Executable file
BIN
deps_install/bin/pcl_radius_filter
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_sac_segmentation_plane
Executable file
BIN
deps_install/bin/pcl_sac_segmentation_plane
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_spin_estimation
Executable file
BIN
deps_install/bin/pcl_spin_estimation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_train_linemod_template
Executable file
BIN
deps_install/bin/pcl_train_linemod_template
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_train_unary_classifier
Executable file
BIN
deps_install/bin/pcl_train_unary_classifier
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_transform_from_viewpoint
Executable file
BIN
deps_install/bin/pcl_transform_from_viewpoint
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_transform_point_cloud
Executable file
BIN
deps_install/bin/pcl_transform_point_cloud
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_unary_classifier_segment
Executable file
BIN
deps_install/bin/pcl_unary_classifier_segment
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_uniform_sampling
Executable file
BIN
deps_install/bin/pcl_uniform_sampling
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_vfh_estimation
Executable file
BIN
deps_install/bin/pcl_vfh_estimation
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_voxel_grid
Executable file
BIN
deps_install/bin/pcl_voxel_grid
Executable file
Binary file not shown.
BIN
deps_install/bin/pcl_xyz2pcd
Executable file
BIN
deps_install/bin/pcl_xyz2pcd
Executable file
Binary file not shown.
152
deps_install/include/pcl-1.10/pcl/2d/convolution.h
Executable file
152
deps_install/include/pcl-1.10/pcl/2d/convolution.h
Executable file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/filters/filter.h>
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <pcl/pcl_macros.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
namespace pcl {
|
||||
|
||||
/// Point cloud containing edge information.
|
||||
struct EIGEN_ALIGN16 PointXYZIEdge {
|
||||
PCL_ADD_POINT4D; // preferred way of adding a XYZ+padding
|
||||
float magnitude;
|
||||
float direction;
|
||||
float magnitude_x;
|
||||
float magnitude_y;
|
||||
PCL_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned
|
||||
}; // enforce SSE padding for correct memory alignment
|
||||
|
||||
/// A 2D convolution class.
|
||||
template <typename PointT>
|
||||
class Convolution : public Filter<PointT> {
|
||||
public:
|
||||
using Filter<PointT>::input_;
|
||||
|
||||
/**
|
||||
* Extra pixels are added to the input image so that convolution can be performed over
|
||||
* the entire image.
|
||||
*
|
||||
* (kernel_height/2) rows are added before the first row and after the last row
|
||||
* (kernel_width/2) columns are added before the first column and after the last
|
||||
* column border options define what values are set for these extra rows and columns
|
||||
*
|
||||
* Assume that the three rows of right edge of the image looks like this:
|
||||
* .. 3 2 1
|
||||
* .. 6 5 4
|
||||
* .. 9 8 7
|
||||
*
|
||||
* BOUNDARY_OPTION_CLAMP : the extra pixels are set to the pixel value of the boundary
|
||||
* pixel. This option makes it seem as if it were:
|
||||
* .. 3 2 1| 1 1 1 ..
|
||||
* .. 6 5 4| 4 4 4 ..
|
||||
* .. 9 8 7| 7 7 7 ..
|
||||
*
|
||||
* BOUNDARY_OPTION_MIRROR : the input image is mirrored at the boundary. This option
|
||||
* makes it seem as if it were:
|
||||
* .. 3 2 1| 1 2 3 ..
|
||||
* .. 6 5 4| 4 5 6 ..
|
||||
* .. 9 8 7| 7 8 9 ..
|
||||
*
|
||||
* BOUNDARY_OPTION_ZERO_PADDING : the extra pixels are simply set to 0. This option
|
||||
* makes it seem as if it were:
|
||||
* .. 3 2 1| 0 0 0 ..
|
||||
* .. 6 5 4| 0 0 0 ..
|
||||
* .. 9 8 7| 0 0 0 ..
|
||||
*
|
||||
* Note that the input image is not actually extended in size. Instead, based on these
|
||||
* options, the convolution is performed differently at the border pixels.
|
||||
*/
|
||||
enum BOUNDARY_OPTIONS_ENUM {
|
||||
BOUNDARY_OPTION_CLAMP,
|
||||
BOUNDARY_OPTION_MIRROR,
|
||||
BOUNDARY_OPTION_ZERO_PADDING
|
||||
};
|
||||
|
||||
Convolution() { boundary_options_ = BOUNDARY_OPTION_CLAMP; }
|
||||
|
||||
/** \brief Sets the kernel to be used for convolution
|
||||
* \param[in] kernel convolution kernel passed by reference
|
||||
*/
|
||||
inline void
|
||||
setKernel(const pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel_ = kernel;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param[in] boundary_options enum indicating the boundary options to be used for
|
||||
* convolution
|
||||
*/
|
||||
inline void
|
||||
setBoundaryOptions(BOUNDARY_OPTIONS_ENUM boundary_options)
|
||||
{
|
||||
boundary_options_ = boundary_options;
|
||||
}
|
||||
|
||||
/** \brief Performs 2D convolution of the input point cloud with the kernel.
|
||||
* Uses clamp as the default boundary option.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
filter(pcl::PointCloud<PointT>& output);
|
||||
|
||||
protected:
|
||||
/** \brief This is an over-ride function for the pcl::Filter interface. */
|
||||
void
|
||||
applyFilter(pcl::PointCloud<PointT>&) override
|
||||
{}
|
||||
|
||||
private:
|
||||
BOUNDARY_OPTIONS_ENUM boundary_options_;
|
||||
pcl::PointCloud<PointT> kernel_;
|
||||
};
|
||||
} // namespace pcl
|
||||
|
||||
#include <pcl/2d/impl/convolution.hpp>
|
||||
|
||||
POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointXYZIEdge, //
|
||||
(float, x, x) //
|
||||
(float, y, y) //
|
||||
(float, z, z) //
|
||||
(float, magnitude, magnitude) //
|
||||
(float, direction, direction) //
|
||||
(float, magnitude_x, magnitude_x) //
|
||||
(float, magnitude_y, magnitude_y)) //
|
||||
313
deps_install/include/pcl-1.10/pcl/2d/edge.h
Executable file
313
deps_install/include/pcl-1.10/pcl/2d/edge.h
Executable file
@@ -0,0 +1,313 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/2d/convolution.h>
|
||||
#include <pcl/2d/kernel.h>
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <pcl/pcl_macros.h>
|
||||
|
||||
namespace pcl {
|
||||
|
||||
template <typename PointInT, typename PointOutT>
|
||||
class Edge {
|
||||
private:
|
||||
using PointCloudIn = pcl::PointCloud<PointInT>;
|
||||
using PointCloudInPtr = typename PointCloudIn::Ptr;
|
||||
|
||||
PointCloudInPtr input_;
|
||||
pcl::Convolution<PointInT> convolution_;
|
||||
kernel<PointInT> kernel_;
|
||||
|
||||
/** \brief This function performs edge tracing for Canny Edge detector.
|
||||
*
|
||||
* \param[in] rowOffset row offset for direction in which the edge is to be traced
|
||||
* \param[in] colOffset column offset for direction in which the edge is to be traced
|
||||
* \param[in] row row location of the edge point
|
||||
* \param[in] col column location of the edge point
|
||||
* \param[out] maxima point cloud containing the edge information in the magnitude
|
||||
* channel
|
||||
*/
|
||||
inline void
|
||||
cannyTraceEdge(int rowOffset,
|
||||
int colOffset,
|
||||
int row,
|
||||
int col,
|
||||
pcl::PointCloud<pcl::PointXYZI>& maxima);
|
||||
|
||||
/** \brief This function discretizes the edge directions in steps of 22.5 degrees.
|
||||
* \param thet point cloud containing the edge information in the direction channel
|
||||
*/
|
||||
void
|
||||
discretizeAngles(pcl::PointCloud<PointOutT>& thet);
|
||||
|
||||
/** \brief This function suppresses the edges which don't form a local maximum
|
||||
* in the edge direction.
|
||||
* \param[in] edges point cloud containing all the edges
|
||||
* \param[out] maxima point cloud containing the non-max suppressed edges
|
||||
* \param[in] tLow
|
||||
*/
|
||||
void
|
||||
suppressNonMaxima(const pcl::PointCloud<PointXYZIEdge>& edges,
|
||||
pcl::PointCloud<pcl::PointXYZI>& maxima,
|
||||
float tLow);
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr<Edge<PointInT, PointOutT>>;
|
||||
using ConstPtr = shared_ptr<const Edge<PointInT, PointOutT>>;
|
||||
|
||||
enum OUTPUT_TYPE {
|
||||
OUTPUT_Y,
|
||||
OUTPUT_X,
|
||||
OUTPUT_X_Y,
|
||||
OUTPUT_MAGNITUDE,
|
||||
OUTPUT_DIRECTION,
|
||||
OUTPUT_MAGNITUDE_DIRECTION,
|
||||
OUTPUT_ALL
|
||||
};
|
||||
|
||||
enum DETECTOR_KERNEL_TYPE {
|
||||
CANNY,
|
||||
SOBEL,
|
||||
PREWITT,
|
||||
ROBERTS,
|
||||
LOG,
|
||||
DERIVATIVE_CENTRAL,
|
||||
DERIVATIVE_FORWARD,
|
||||
DERIVATIVE_BACKWARD
|
||||
};
|
||||
|
||||
private:
|
||||
OUTPUT_TYPE output_type_;
|
||||
DETECTOR_KERNEL_TYPE detector_kernel_type_;
|
||||
bool non_maximal_suppression_;
|
||||
bool hysteresis_thresholding_;
|
||||
|
||||
float hysteresis_threshold_low_;
|
||||
float hysteresis_threshold_high_;
|
||||
float non_max_suppression_radius_x_;
|
||||
float non_max_suppression_radius_y_;
|
||||
|
||||
public:
|
||||
Edge()
|
||||
: output_type_(OUTPUT_X)
|
||||
, detector_kernel_type_(SOBEL)
|
||||
, non_maximal_suppression_(false)
|
||||
, hysteresis_thresholding_(false)
|
||||
, hysteresis_threshold_low_(20)
|
||||
, hysteresis_threshold_high_(80)
|
||||
, non_max_suppression_radius_x_(3)
|
||||
, non_max_suppression_radius_y_(3)
|
||||
{}
|
||||
|
||||
/** \brief Set the output type.
|
||||
* \param[in] output_type the output type
|
||||
*/
|
||||
void
|
||||
setOutputType(OUTPUT_TYPE output_type)
|
||||
{
|
||||
output_type_ = output_type;
|
||||
}
|
||||
|
||||
void
|
||||
setHysteresisThresholdLow(float threshold)
|
||||
{
|
||||
hysteresis_threshold_low_ = threshold;
|
||||
}
|
||||
|
||||
void
|
||||
setHysteresisThresholdHigh(float threshold)
|
||||
{
|
||||
hysteresis_threshold_high_ = threshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param[in] input_x
|
||||
* \param[in] input_y
|
||||
* \param[out] output
|
||||
*/
|
||||
void
|
||||
sobelMagnitudeDirection(const pcl::PointCloud<PointInT>& input_x,
|
||||
const pcl::PointCloud<PointInT>& input_y,
|
||||
pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** Perform Canny edge detection with two separated input images for horizontal and
|
||||
* vertical derivatives.
|
||||
*
|
||||
* All edges of magnitude above t_high are always classified as edges. All edges
|
||||
* below t_low are discarded. Edge values between t_low and t_high are classified
|
||||
* as edges only if they are connected to edges having magnitude > t_high and are
|
||||
* located in a direction perpendicular to that strong edge.
|
||||
*
|
||||
* \param[in] input_x Input point cloud passed by reference for the first derivative
|
||||
* in the horizontal direction
|
||||
* \param[in] input_y Input point cloud passed by reference for the first derivative
|
||||
* in the vertical direction
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
canny(const pcl::PointCloud<PointInT>& input_x,
|
||||
const pcl::PointCloud<PointInT>& input_y,
|
||||
pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief This is a convenience function which performs edge detection based on
|
||||
* the variable detector_kernel_type_
|
||||
* \param[out] output
|
||||
*/
|
||||
void
|
||||
detectEdge(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief All edges of magnitude above t_high are always classified as edges.
|
||||
* All edges below t_low are discarded.
|
||||
* Edge values between t_low and t_high are classified as edges only if they are
|
||||
* connected to edges having magnitude > t_high and are located in a direction
|
||||
* perpendicular to that strong edge.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
detectEdgeCanny(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Uses the Sobel kernel for edge detection.
|
||||
* This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
detectEdgeSobel(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Uses the Prewitt kernel for edge detection.
|
||||
* This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
detectEdgePrewitt(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Uses the Roberts kernel for edge detection.
|
||||
* This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
detectEdgeRoberts(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Uses the LoG kernel for edge detection.
|
||||
* Zero crossings of the Laplacian operator applied on an image indicate edges.
|
||||
* Gaussian kernel is used to smoothen the image prior to the Laplacian.
|
||||
* This is because Laplacian uses the second order derivative of the image and hence,
|
||||
* is very sensitive to noise. The implementation is not two-step but rather applies
|
||||
* the LoG kernel directly.
|
||||
*
|
||||
* \param[in] kernel_sigma variance of the LoG kernel used.
|
||||
* \param[in] kernel_size a LoG kernel of dimensions kernel_size x kernel_size is
|
||||
* used.
|
||||
* \param[out] output Output point cloud passed by reference.
|
||||
*/
|
||||
void
|
||||
detectEdgeLoG(const float kernel_sigma,
|
||||
const float kernel_size,
|
||||
pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in X direction using the kernel
|
||||
* kernel::derivativeYCentralKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeXCentral(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in Y direction using the kernel
|
||||
* kernel::derivativeYCentralKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeYCentral(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in X direction using the kernel
|
||||
* kernel::derivativeYForwardKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeXForward(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in Y direction using the kernel
|
||||
* kernel::derivativeYForwardKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeYForward(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in X direction using the kernel
|
||||
* kernel::derivativeXBackwardKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeXBackward(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Computes the image derivatives in Y direction using the kernel
|
||||
* kernel::derivativeYBackwardKernel. This function does NOT include a smoothing step.
|
||||
* The image should be smoothed before using this function to reduce noise.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
computeDerivativeYBackward(pcl::PointCloud<PointOutT>& output);
|
||||
|
||||
/** \brief Override function to implement the pcl::Filter interface */
|
||||
void
|
||||
applyFilter(pcl::PointCloud<PointOutT>& /*output*/)
|
||||
{}
|
||||
|
||||
/** \brief Set the input point cloud pointer
|
||||
* \param[in] input pointer to input point cloud
|
||||
*/
|
||||
void
|
||||
setInputCloud(PointCloudInPtr input)
|
||||
{
|
||||
input_ = input;
|
||||
}
|
||||
|
||||
PCL_MAKE_ALIGNED_OPERATOR_NEW
|
||||
};
|
||||
|
||||
} // namespace pcl
|
||||
|
||||
#include <pcl/2d/impl/edge.hpp>
|
||||
137
deps_install/include/pcl-1.10/pcl/2d/impl/convolution.hpp
Executable file
137
deps_install/include/pcl-1.10/pcl/2d/impl/convolution.hpp
Executable file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PCL_2D_CONVOLUTION_IMPL_HPP
|
||||
#define PCL_2D_CONVOLUTION_IMPL_HPP
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Convolution<PointT>::filter(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
int input_row = 0;
|
||||
int input_col = 0;
|
||||
// default boundary option : zero padding
|
||||
output = *input_;
|
||||
|
||||
int iw = static_cast<int>(input_->width), ih = static_cast<int>(input_->height),
|
||||
kw = static_cast<int>(kernel_.width), kh = static_cast<int>(kernel_.height);
|
||||
switch (boundary_options_) {
|
||||
default:
|
||||
case BOUNDARY_OPTION_CLAMP: {
|
||||
for (int i = 0; i < ih; i++) {
|
||||
for (int j = 0; j < iw; j++) {
|
||||
float intensity = 0;
|
||||
for (int k = 0; k < kh; k++) {
|
||||
for (int l = 0; l < kw; l++) {
|
||||
int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
|
||||
if (ikkh < 0)
|
||||
input_row = 0;
|
||||
else if (ikkh >= ih)
|
||||
input_row = ih - 1;
|
||||
else
|
||||
input_row = ikkh;
|
||||
|
||||
if (jlkw < 0)
|
||||
input_col = 0;
|
||||
else if (jlkw >= iw)
|
||||
input_col = iw - 1;
|
||||
else
|
||||
input_col = jlkw;
|
||||
|
||||
intensity +=
|
||||
kernel_(l, k).intensity * (*input_)(input_col, input_row).intensity;
|
||||
}
|
||||
}
|
||||
output(j, i).intensity = intensity;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BOUNDARY_OPTION_MIRROR: {
|
||||
for (int i = 0; i < ih; i++) {
|
||||
for (int j = 0; j < iw; j++) {
|
||||
float intensity = 0;
|
||||
for (int k = 0; k < kh; k++) {
|
||||
for (int l = 0; l < kw; l++) {
|
||||
int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
|
||||
if (ikkh < 0)
|
||||
input_row = -ikkh - 1;
|
||||
else if (ikkh >= ih)
|
||||
input_row = 2 * ih - 1 - ikkh;
|
||||
else
|
||||
input_row = ikkh;
|
||||
|
||||
if (jlkw < 0)
|
||||
input_col = -jlkw - 1;
|
||||
else if (jlkw >= iw)
|
||||
input_col = 2 * iw - 1 - jlkw;
|
||||
else
|
||||
input_col = jlkw;
|
||||
|
||||
intensity +=
|
||||
kernel_(l, k).intensity * ((*input_)(input_col, input_row).intensity);
|
||||
}
|
||||
}
|
||||
output(j, i).intensity = intensity;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BOUNDARY_OPTION_ZERO_PADDING: {
|
||||
for (int i = 0; i < ih; i++) {
|
||||
for (int j = 0; j < iw; j++) {
|
||||
float intensity = 0;
|
||||
for (int k = 0; k < kh; k++) {
|
||||
for (int l = 0; l < kw; l++) {
|
||||
int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
|
||||
if (ikkh < 0 || ikkh >= ih || jlkw < 0 || jlkw >= iw)
|
||||
continue;
|
||||
intensity += kernel_(l, k).intensity * ((*input_)(jlkw, ikkh).intensity);
|
||||
}
|
||||
}
|
||||
output(j, i).intensity = intensity;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} // switch
|
||||
}
|
||||
|
||||
#endif
|
||||
473
deps_install/include/pcl-1.10/pcl/2d/impl/edge.hpp
Executable file
473
deps_install/include/pcl-1.10/pcl/2d/impl/edge.hpp
Executable file
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PCL_2D_EDGE_IMPL_HPP
|
||||
#define PCL_2D_EDGE_IMPL_HPP
|
||||
|
||||
#include <pcl/2d/convolution.h>
|
||||
#include <pcl/common/common_headers.h> // rad2deg()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::detectEdgeSobel(pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
convolution_.setInputCloud(input_);
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_x(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_x(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::SOBEL_X);
|
||||
kernel_.fetchKernel(*kernel_x);
|
||||
convolution_.setKernel(*kernel_x);
|
||||
convolution_.filter(*magnitude_x);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_y(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_y(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::SOBEL_Y);
|
||||
kernel_.fetchKernel(*kernel_y);
|
||||
convolution_.setKernel(*kernel_y);
|
||||
convolution_.filter(*magnitude_y);
|
||||
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
output[i].magnitude_x = (*magnitude_x)[i].intensity;
|
||||
output[i].magnitude_y = (*magnitude_y)[i].intensity;
|
||||
output[i].magnitude =
|
||||
std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
|
||||
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
|
||||
output[i].direction =
|
||||
std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::sobelMagnitudeDirection(
|
||||
const pcl::PointCloud<PointInT>& input_x,
|
||||
const pcl::PointCloud<PointInT>& input_y,
|
||||
pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
convolution_.setInputCloud(input_x.makeShared());
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_x(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_x(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::SOBEL_X);
|
||||
kernel_.fetchKernel(*kernel_x);
|
||||
convolution_.setKernel(*kernel_x);
|
||||
convolution_.filter(*magnitude_x);
|
||||
|
||||
convolution_.setInputCloud(input_y.makeShared());
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_y(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_y(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::SOBEL_Y);
|
||||
kernel_.fetchKernel(*kernel_y);
|
||||
convolution_.setKernel(*kernel_y);
|
||||
convolution_.filter(*magnitude_y);
|
||||
|
||||
const int height = input_x.height;
|
||||
const int width = input_x.width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
output[i].magnitude_x = (*magnitude_x)[i].intensity;
|
||||
output[i].magnitude_y = (*magnitude_y)[i].intensity;
|
||||
output[i].magnitude =
|
||||
std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
|
||||
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
|
||||
output[i].direction =
|
||||
std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::detectEdgePrewitt(pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
convolution_.setInputCloud(input_);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_x(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_x(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::PREWITT_X);
|
||||
kernel_.fetchKernel(*kernel_x);
|
||||
convolution_.setKernel(*kernel_x);
|
||||
convolution_.filter(*magnitude_x);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_y(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_y(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::PREWITT_Y);
|
||||
kernel_.fetchKernel(*kernel_y);
|
||||
convolution_.setKernel(*kernel_y);
|
||||
convolution_.filter(*magnitude_y);
|
||||
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
output[i].magnitude_x = (*magnitude_x)[i].intensity;
|
||||
output[i].magnitude_y = (*magnitude_y)[i].intensity;
|
||||
output[i].magnitude =
|
||||
std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
|
||||
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
|
||||
output[i].direction =
|
||||
std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::detectEdgeRoberts(pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
convolution_.setInputCloud(input_);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_x(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_x(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::ROBERTS_X);
|
||||
kernel_.fetchKernel(*kernel_x);
|
||||
convolution_.setKernel(*kernel_x);
|
||||
convolution_.filter(*magnitude_x);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr kernel_y(new pcl::PointCloud<PointXYZI>);
|
||||
pcl::PointCloud<PointXYZI>::Ptr magnitude_y(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::ROBERTS_Y);
|
||||
kernel_.fetchKernel(*kernel_y);
|
||||
convolution_.setKernel(*kernel_y);
|
||||
convolution_.filter(*magnitude_y);
|
||||
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
output[i].magnitude_x = (*magnitude_x)[i].intensity;
|
||||
output[i].magnitude_y = (*magnitude_y)[i].intensity;
|
||||
output[i].magnitude =
|
||||
std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity +
|
||||
(*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity);
|
||||
output[i].direction =
|
||||
std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::cannyTraceEdge(
|
||||
int rowOffset, int colOffset, int row, int col, pcl::PointCloud<PointXYZI>& maxima)
|
||||
{
|
||||
int newRow = row + rowOffset;
|
||||
int newCol = col + colOffset;
|
||||
PointXYZI& pt = maxima(newCol, newRow);
|
||||
|
||||
if (newRow > 0 && newRow < static_cast<int>(maxima.height) && newCol > 0 &&
|
||||
newCol < static_cast<int>(maxima.width)) {
|
||||
if (pt.intensity == 0.0f || pt.intensity == std::numeric_limits<float>::max())
|
||||
return;
|
||||
|
||||
pt.intensity = std::numeric_limits<float>::max();
|
||||
cannyTraceEdge(1, 0, newRow, newCol, maxima);
|
||||
cannyTraceEdge(-1, 0, newRow, newCol, maxima);
|
||||
cannyTraceEdge(1, 1, newRow, newCol, maxima);
|
||||
cannyTraceEdge(-1, -1, newRow, newCol, maxima);
|
||||
cannyTraceEdge(0, -1, newRow, newCol, maxima);
|
||||
cannyTraceEdge(0, 1, newRow, newCol, maxima);
|
||||
cannyTraceEdge(-1, 1, newRow, newCol, maxima);
|
||||
cannyTraceEdge(1, -1, newRow, newCol, maxima);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::discretizeAngles(pcl::PointCloud<PointOutT>& thet)
|
||||
{
|
||||
const int height = thet.height;
|
||||
const int width = thet.width;
|
||||
float angle;
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
angle = pcl::rad2deg(thet(j, i).direction);
|
||||
if (((angle <= 22.5) && (angle >= -22.5)) || (angle >= 157.5) ||
|
||||
(angle <= -157.5))
|
||||
thet(j, i).direction = 0;
|
||||
else if (((angle > 22.5) && (angle < 67.5)) ||
|
||||
((angle < -112.5) && (angle > -157.5)))
|
||||
thet(j, i).direction = 45;
|
||||
else if (((angle >= 67.5) && (angle <= 112.5)) ||
|
||||
((angle <= -67.5) && (angle >= -112.5)))
|
||||
thet(j, i).direction = 90;
|
||||
else if (((angle > 112.5) && (angle < 157.5)) ||
|
||||
((angle < -22.5) && (angle > -67.5)))
|
||||
thet(j, i).direction = 135;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::suppressNonMaxima(
|
||||
const pcl::PointCloud<PointXYZIEdge>& edges,
|
||||
pcl::PointCloud<PointXYZI>& maxima,
|
||||
float tLow)
|
||||
{
|
||||
const int height = edges.height;
|
||||
const int width = edges.width;
|
||||
|
||||
maxima.height = height;
|
||||
maxima.width = width;
|
||||
maxima.resize(height * width);
|
||||
|
||||
for (auto& point : maxima)
|
||||
point.intensity = 0.0f;
|
||||
|
||||
// tHigh and non-maximal supression
|
||||
for (int i = 1; i < height - 1; i++) {
|
||||
for (int j = 1; j < width - 1; j++) {
|
||||
const PointXYZIEdge& ptedge = edges(j, i);
|
||||
PointXYZI& ptmax = maxima(j, i);
|
||||
|
||||
if (ptedge.magnitude < tLow)
|
||||
continue;
|
||||
|
||||
// maxima (j, i).intensity = 0;
|
||||
|
||||
switch (int(ptedge.direction)) {
|
||||
case 0: {
|
||||
if (ptedge.magnitude >= edges(j - 1, i).magnitude &&
|
||||
ptedge.magnitude >= edges(j + 1, i).magnitude)
|
||||
ptmax.intensity = ptedge.magnitude;
|
||||
break;
|
||||
}
|
||||
case 45: {
|
||||
if (ptedge.magnitude >= edges(j - 1, i - 1).magnitude &&
|
||||
ptedge.magnitude >= edges(j + 1, i + 1).magnitude)
|
||||
ptmax.intensity = ptedge.magnitude;
|
||||
break;
|
||||
}
|
||||
case 90: {
|
||||
if (ptedge.magnitude >= edges(j, i - 1).magnitude &&
|
||||
ptedge.magnitude >= edges(j, i + 1).magnitude)
|
||||
ptmax.intensity = ptedge.magnitude;
|
||||
break;
|
||||
}
|
||||
case 135: {
|
||||
if (ptedge.magnitude >= edges(j + 1, i - 1).magnitude &&
|
||||
ptedge.magnitude >= edges(j - 1, i + 1).magnitude)
|
||||
ptmax.intensity = ptedge.magnitude;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::detectEdgeCanny(pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
float tHigh = hysteresis_threshold_high_;
|
||||
float tLow = hysteresis_threshold_low_;
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
// Noise reduction using gaussian blurring
|
||||
pcl::PointCloud<PointXYZI>::Ptr gaussian_kernel(new pcl::PointCloud<PointXYZI>);
|
||||
PointCloudInPtr smoothed_cloud(new PointCloudIn);
|
||||
kernel_.setKernelSize(3);
|
||||
kernel_.setKernelSigma(1.0);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::GAUSSIAN);
|
||||
kernel_.fetchKernel(*gaussian_kernel);
|
||||
convolution_.setKernel(*gaussian_kernel);
|
||||
convolution_.setInputCloud(input_);
|
||||
convolution_.filter(*smoothed_cloud);
|
||||
|
||||
// Edge detection using Sobel
|
||||
pcl::PointCloud<PointXYZIEdge>::Ptr edges(new pcl::PointCloud<PointXYZIEdge>);
|
||||
setInputCloud(smoothed_cloud);
|
||||
detectEdgeSobel(*edges);
|
||||
|
||||
// Edge discretization
|
||||
discretizeAngles(*edges);
|
||||
|
||||
// tHigh and non-maximal supression
|
||||
pcl::PointCloud<PointXYZI>::Ptr maxima(new pcl::PointCloud<PointXYZI>);
|
||||
suppressNonMaxima(*edges, *maxima, tLow);
|
||||
|
||||
// Edge tracing
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
if ((*maxima)(j, i).intensity < tHigh ||
|
||||
(*maxima)(j, i).intensity == std::numeric_limits<float>::max())
|
||||
continue;
|
||||
|
||||
(*maxima)(j, i).intensity = std::numeric_limits<float>::max();
|
||||
cannyTraceEdge(1, 0, i, j, *maxima);
|
||||
cannyTraceEdge(-1, 0, i, j, *maxima);
|
||||
cannyTraceEdge(1, 1, i, j, *maxima);
|
||||
cannyTraceEdge(-1, -1, i, j, *maxima);
|
||||
cannyTraceEdge(0, -1, i, j, *maxima);
|
||||
cannyTraceEdge(0, 1, i, j, *maxima);
|
||||
cannyTraceEdge(-1, 1, i, j, *maxima);
|
||||
cannyTraceEdge(1, -1, i, j, *maxima);
|
||||
}
|
||||
}
|
||||
|
||||
// Final thresholding
|
||||
for (std::size_t i = 0; i < input_->size(); ++i) {
|
||||
if ((*maxima)[i].intensity == std::numeric_limits<float>::max())
|
||||
output[i].magnitude = 255;
|
||||
else
|
||||
output[i].magnitude = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::canny(const pcl::PointCloud<PointInT>& input_x,
|
||||
const pcl::PointCloud<PointInT>& input_y,
|
||||
pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
float tHigh = hysteresis_threshold_high_;
|
||||
float tLow = hysteresis_threshold_low_;
|
||||
const int height = input_x.height;
|
||||
const int width = input_x.width;
|
||||
|
||||
output.resize(height * width);
|
||||
output.height = height;
|
||||
output.width = width;
|
||||
|
||||
// Noise reduction using gaussian blurring
|
||||
pcl::PointCloud<PointXYZI>::Ptr gaussian_kernel(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelSize(3);
|
||||
kernel_.setKernelSigma(1.0);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::GAUSSIAN);
|
||||
kernel_.fetchKernel(*gaussian_kernel);
|
||||
convolution_.setKernel(*gaussian_kernel);
|
||||
|
||||
PointCloudIn smoothed_cloud_x;
|
||||
convolution_.setInputCloud(input_x.makeShared());
|
||||
convolution_.filter(smoothed_cloud_x);
|
||||
|
||||
PointCloudIn smoothed_cloud_y;
|
||||
convolution_.setInputCloud(input_y.makeShared());
|
||||
convolution_.filter(smoothed_cloud_y);
|
||||
|
||||
// Edge detection using Sobel
|
||||
pcl::PointCloud<PointXYZIEdge>::Ptr edges(new pcl::PointCloud<PointXYZIEdge>);
|
||||
sobelMagnitudeDirection(smoothed_cloud_x, smoothed_cloud_y, *edges.get());
|
||||
|
||||
// Edge discretization
|
||||
discretizeAngles(*edges);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr maxima(new pcl::PointCloud<PointXYZI>);
|
||||
suppressNonMaxima(*edges, *maxima, tLow);
|
||||
|
||||
// Edge tracing
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
if ((*maxima)(j, i).intensity < tHigh ||
|
||||
(*maxima)(j, i).intensity == std::numeric_limits<float>::max())
|
||||
continue;
|
||||
|
||||
(*maxima)(j, i).intensity = std::numeric_limits<float>::max();
|
||||
|
||||
// clang-format off
|
||||
cannyTraceEdge( 1, 0, i, j, *maxima);
|
||||
cannyTraceEdge(-1, 0, i, j, *maxima);
|
||||
cannyTraceEdge( 1, 1, i, j, *maxima);
|
||||
cannyTraceEdge(-1, -1, i, j, *maxima);
|
||||
cannyTraceEdge( 0, -1, i, j, *maxima);
|
||||
cannyTraceEdge( 0, 1, i, j, *maxima);
|
||||
cannyTraceEdge(-1, 1, i, j, *maxima);
|
||||
cannyTraceEdge( 1, -1, i, j, *maxima);
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
// Final thresholding
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
if ((*maxima)(j, i).intensity == std::numeric_limits<float>::max())
|
||||
output(j, i).magnitude = 255;
|
||||
else
|
||||
output(j, i).magnitude = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointInT, typename PointOutT>
|
||||
void
|
||||
pcl::Edge<PointInT, PointOutT>::detectEdgeLoG(const float kernel_sigma,
|
||||
const float kernel_size,
|
||||
pcl::PointCloud<PointOutT>& output)
|
||||
{
|
||||
convolution_.setInputCloud(input_);
|
||||
|
||||
pcl::PointCloud<PointXYZI>::Ptr log_kernel(new pcl::PointCloud<PointXYZI>);
|
||||
kernel_.setKernelType(kernel<PointXYZI>::LOG);
|
||||
kernel_.setKernelSigma(kernel_sigma);
|
||||
kernel_.setKernelSize(kernel_size);
|
||||
kernel_.fetchKernel(*log_kernel);
|
||||
convolution_.setKernel(*log_kernel);
|
||||
convolution_.filter(output);
|
||||
}
|
||||
|
||||
#endif
|
||||
353
deps_install/include/pcl-1.10/pcl/2d/impl/kernel.hpp
Executable file
353
deps_install/include/pcl-1.10/pcl/2d/impl/kernel.hpp
Executable file
@@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PCL_2D_KERNEL_IMPL_HPP
|
||||
#define PCL_2D_KERNEL_IMPL_HPP
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::fetchKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
switch (kernel_type_) {
|
||||
case SOBEL_X:
|
||||
sobelKernelX(kernel);
|
||||
break;
|
||||
case SOBEL_Y:
|
||||
sobelKernelY(kernel);
|
||||
break;
|
||||
case PREWITT_X:
|
||||
prewittKernelX(kernel);
|
||||
break;
|
||||
case PREWITT_Y:
|
||||
prewittKernelY(kernel);
|
||||
break;
|
||||
case ROBERTS_X:
|
||||
robertsKernelX(kernel);
|
||||
break;
|
||||
case ROBERTS_Y:
|
||||
robertsKernelY(kernel);
|
||||
break;
|
||||
case LOG:
|
||||
loGKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_CENTRAL_X:
|
||||
derivativeXCentralKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_FORWARD_X:
|
||||
derivativeXForwardKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_BACKWARD_X:
|
||||
derivativeXBackwardKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_CENTRAL_Y:
|
||||
derivativeYCentralKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_FORWARD_Y:
|
||||
derivativeYForwardKernel(kernel);
|
||||
break;
|
||||
case DERIVATIVE_BACKWARD_Y:
|
||||
derivativeYBackwardKernel(kernel);
|
||||
break;
|
||||
case GAUSSIAN:
|
||||
gaussianKernel(kernel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::gaussianKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
float sum = 0;
|
||||
kernel.resize(kernel_size_ * kernel_size_);
|
||||
kernel.height = kernel_size_;
|
||||
kernel.width = kernel_size_;
|
||||
|
||||
double sigma_sqr = 2 * sigma_ * sigma_;
|
||||
|
||||
for (int i = 0; i < kernel_size_; i++) {
|
||||
for (int j = 0; j < kernel_size_; j++) {
|
||||
int iks = (i - kernel_size_ / 2);
|
||||
int jks = (j - kernel_size_ / 2);
|
||||
kernel(j, i).intensity =
|
||||
std::exp(float(-double(iks * iks + jks * jks) / sigma_sqr));
|
||||
sum += float(kernel(j, i).intensity);
|
||||
}
|
||||
}
|
||||
|
||||
// Normalizing the kernel
|
||||
for (std::size_t i = 0; i < kernel.size(); ++i)
|
||||
kernel[i].intensity /= sum;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::loGKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
float sum = 0;
|
||||
float temp = 0;
|
||||
kernel.resize(kernel_size_ * kernel_size_);
|
||||
kernel.height = kernel_size_;
|
||||
kernel.width = kernel_size_;
|
||||
|
||||
double sigma_sqr = 2 * sigma_ * sigma_;
|
||||
|
||||
for (int i = 0; i < kernel_size_; i++) {
|
||||
for (int j = 0; j < kernel_size_; j++) {
|
||||
int iks = (i - kernel_size_ / 2);
|
||||
int jks = (j - kernel_size_ / 2);
|
||||
temp = float(double(iks * iks + jks * jks) / sigma_sqr);
|
||||
kernel(j, i).intensity = (1.0f - temp) * std::exp(-temp);
|
||||
sum += kernel(j, i).intensity;
|
||||
}
|
||||
}
|
||||
|
||||
// Normalizing the kernel
|
||||
for (std::size_t i = 0; i < kernel.size(); ++i)
|
||||
kernel[i].intensity /= sum;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::sobelKernelX(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(9);
|
||||
kernel.height = 3;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(1, 0).intensity = 0;
|
||||
kernel(2, 0).intensity = 1;
|
||||
kernel(0, 1).intensity = -2;
|
||||
kernel(1, 1).intensity = 0;
|
||||
kernel(2, 1).intensity = 2;
|
||||
kernel(0, 2).intensity = -1;
|
||||
kernel(1, 2).intensity = 0;
|
||||
kernel(2, 2).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::prewittKernelX(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(9);
|
||||
kernel.height = 3;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(1, 0).intensity = 0;
|
||||
kernel(2, 0).intensity = 1;
|
||||
kernel(0, 1).intensity = -1;
|
||||
kernel(1, 1).intensity = 0;
|
||||
kernel(2, 1).intensity = 1;
|
||||
kernel(0, 2).intensity = -1;
|
||||
kernel(1, 2).intensity = 0;
|
||||
kernel(2, 2).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::robertsKernelX(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(4);
|
||||
kernel.height = 2;
|
||||
kernel.width = 2;
|
||||
kernel(0, 0).intensity = 1;
|
||||
kernel(1, 0).intensity = 0;
|
||||
kernel(0, 1).intensity = 0;
|
||||
kernel(1, 1).intensity = -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::sobelKernelY(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(9);
|
||||
kernel.height = 3;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(1, 0).intensity = -2;
|
||||
kernel(2, 0).intensity = -1;
|
||||
kernel(0, 1).intensity = 0;
|
||||
kernel(1, 1).intensity = 0;
|
||||
kernel(2, 1).intensity = 0;
|
||||
kernel(0, 2).intensity = 1;
|
||||
kernel(1, 2).intensity = 2;
|
||||
kernel(2, 2).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::prewittKernelY(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(9);
|
||||
kernel.height = 3;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = 1;
|
||||
kernel(1, 0).intensity = 1;
|
||||
kernel(2, 0).intensity = 1;
|
||||
kernel(0, 1).intensity = 0;
|
||||
kernel(1, 1).intensity = 0;
|
||||
kernel(2, 1).intensity = 0;
|
||||
kernel(0, 2).intensity = -1;
|
||||
kernel(1, 2).intensity = -1;
|
||||
kernel(2, 2).intensity = -1;
|
||||
}
|
||||
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::robertsKernelY(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(4);
|
||||
kernel.height = 2;
|
||||
kernel.width = 2;
|
||||
kernel(0, 0).intensity = 0;
|
||||
kernel(1, 0).intensity = 1;
|
||||
kernel(0, 1).intensity = -1;
|
||||
kernel(1, 1).intensity = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeXCentralKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 1;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(1, 0).intensity = 0;
|
||||
kernel(2, 0).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeXForwardKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 1;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = 0;
|
||||
kernel(1, 0).intensity = -1;
|
||||
kernel(2, 0).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeXBackwardKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 1;
|
||||
kernel.width = 3;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(1, 0).intensity = 1;
|
||||
kernel(2, 0).intensity = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeYCentralKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 3;
|
||||
kernel.width = 1;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(0, 1).intensity = 0;
|
||||
kernel(0, 2).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeYForwardKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 3;
|
||||
kernel.width = 1;
|
||||
kernel(0, 0).intensity = 0;
|
||||
kernel(0, 1).intensity = -1;
|
||||
kernel(0, 2).intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::derivativeYBackwardKernel(pcl::PointCloud<PointT>& kernel)
|
||||
{
|
||||
kernel.resize(3);
|
||||
kernel.height = 3;
|
||||
kernel.width = 1;
|
||||
kernel(0, 0).intensity = -1;
|
||||
kernel(0, 1).intensity = 1;
|
||||
kernel(0, 2).intensity = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::setKernelType(KERNEL_ENUM kernel_type)
|
||||
{
|
||||
kernel_type_ = kernel_type;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::setKernelSize(int kernel_size)
|
||||
{
|
||||
kernel_size_ = kernel_size;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::kernel<PointT>::setKernelSigma(float kernel_sigma)
|
||||
{
|
||||
sigma_ = kernel_sigma;
|
||||
}
|
||||
|
||||
#endif
|
||||
379
deps_install/include/pcl-1.10/pcl/2d/impl/morphology.hpp
Executable file
379
deps_install/include/pcl-1.10/pcl/2d/impl/morphology.hpp
Executable file
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PCL_2D_MORPHOLOGY_HPP_
|
||||
#define PCL_2D_MORPHOLOGY_HPP_
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Assumes input, kernel and output images have 0's and 1's only
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::erosionBinary(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
const int kernel_height = structuring_element_->height;
|
||||
const int kernel_width = structuring_element_->width;
|
||||
bool mismatch_flag;
|
||||
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
output.resize(width * height);
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
// Operation done only at 1's
|
||||
if ((*input_)(j, i).intensity == 0) {
|
||||
output(j, i).intensity = 0;
|
||||
continue;
|
||||
}
|
||||
mismatch_flag = false;
|
||||
for (int k = 0; k < kernel_height; k++) {
|
||||
if (mismatch_flag)
|
||||
break;
|
||||
for (int l = 0; l < kernel_width; l++) {
|
||||
// We only check for 1's in the kernel
|
||||
if ((*structuring_element_)(l, k).intensity == 0)
|
||||
continue;
|
||||
if ((i + k - kernel_height / 2) < 0 ||
|
||||
(i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 ||
|
||||
(j + l - kernel_width / 2) >= width) {
|
||||
continue;
|
||||
}
|
||||
// If one of the elements of the kernel and image don't match,
|
||||
// the output image is 0. So, move to the next point.
|
||||
if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2)
|
||||
.intensity != 1) {
|
||||
output(j, i).intensity = 0;
|
||||
mismatch_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Assign value according to mismatch flag
|
||||
output(j, i).intensity = (mismatch_flag) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Assumes input, kernel and output images have 0's and 1's only
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::dilationBinary(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
const int kernel_height = structuring_element_->height;
|
||||
const int kernel_width = structuring_element_->width;
|
||||
bool match_flag;
|
||||
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
output.resize(width * height);
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
match_flag = false;
|
||||
for (int k = 0; k < kernel_height; k++) {
|
||||
if (match_flag)
|
||||
break;
|
||||
for (int l = 0; l < kernel_width; l++) {
|
||||
// We only check for 1's in the kernel
|
||||
if ((*structuring_element_)(l, k).intensity == 0)
|
||||
continue;
|
||||
if ((i + k - kernel_height / 2) < 0 ||
|
||||
(i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 ||
|
||||
(j + l - kernel_width / 2) >= height) {
|
||||
continue;
|
||||
}
|
||||
// If any position where kernel is 1 and image is also one is detected,
|
||||
// matching occurs
|
||||
if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2)
|
||||
.intensity == 1) {
|
||||
match_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Assign value according to match flag
|
||||
output(j, i).intensity = (match_flag) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Assumes input, kernel and output images have 0's and 1's only
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::openingBinary(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
PointCloudInPtr intermediate_output(new PointCloudIn);
|
||||
erosionBinary(*intermediate_output);
|
||||
this->setInputCloud(intermediate_output);
|
||||
dilationBinary(output);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Assumes input, kernel and output images have 0's and 1's only
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::closingBinary(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
PointCloudInPtr intermediate_output(new PointCloudIn);
|
||||
dilationBinary(*intermediate_output);
|
||||
this->setInputCloud(intermediate_output);
|
||||
erosionBinary(output);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::erosionGray(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
const int kernel_height = structuring_element_->height;
|
||||
const int kernel_width = structuring_element_->width;
|
||||
float min;
|
||||
output.resize(width * height);
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
min = -1;
|
||||
for (int k = 0; k < kernel_height; k++) {
|
||||
for (int l = 0; l < kernel_width; l++) {
|
||||
// We only check for 1's in the kernel
|
||||
if ((*structuring_element_)(l, k).intensity == 0)
|
||||
continue;
|
||||
if ((i + k - kernel_height / 2) < 0 ||
|
||||
(i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 ||
|
||||
(j + l - kernel_width / 2) >= width) {
|
||||
continue;
|
||||
}
|
||||
// If one of the elements of the kernel and image don't match,
|
||||
// the output image is 0. So, move to the next point.
|
||||
if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity <
|
||||
min ||
|
||||
min == -1) {
|
||||
min = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2)
|
||||
.intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Assign value according to mismatch flag
|
||||
output(j, i).intensity = min;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::dilationGray(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
const int height = input_->height;
|
||||
const int width = input_->width;
|
||||
const int kernel_height = structuring_element_->height;
|
||||
const int kernel_width = structuring_element_->width;
|
||||
float max;
|
||||
|
||||
output.resize(width * height);
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < width; j++) {
|
||||
max = -1;
|
||||
for (int k = 0; k < kernel_height; k++) {
|
||||
for (int l = 0; l < kernel_width; l++) {
|
||||
// We only check for 1's in the kernel
|
||||
if ((*structuring_element_)(l, k).intensity == 0)
|
||||
continue;
|
||||
if ((i + k - kernel_height / 2) < 0 ||
|
||||
(i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 ||
|
||||
(j + l - kernel_width / 2) >= width) {
|
||||
continue;
|
||||
}
|
||||
// If one of the elements of the kernel and image don't match,
|
||||
// the output image is 0. So, move to the next point.
|
||||
if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity >
|
||||
max ||
|
||||
max == -1) {
|
||||
max = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2)
|
||||
.intensity;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Assign value according to mismatch flag
|
||||
output(j, i).intensity = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::openingGray(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
PointCloudInPtr intermediate_output(new PointCloudIn);
|
||||
erosionGray(*intermediate_output);
|
||||
this->setInputCloud(intermediate_output);
|
||||
dilationGray(output);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::closingGray(pcl::PointCloud<PointT>& output)
|
||||
{
|
||||
PointCloudInPtr intermediate_output(new PointCloudIn);
|
||||
dilationGray(*intermediate_output);
|
||||
this->setInputCloud(intermediate_output);
|
||||
erosionGray(output);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::subtractionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2)
|
||||
{
|
||||
const int height = (input1.height < input2.height) ? input1.height : input2.height;
|
||||
const int width = (input1.width < input2.width) ? input1.width : input2.width;
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
output.resize(height * width);
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
if (input1[i].intensity == 1 && input2[i].intensity == 0)
|
||||
output[i].intensity = 1;
|
||||
else
|
||||
output[i].intensity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::unionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2)
|
||||
{
|
||||
const int height = (input1.height < input2.height) ? input1.height : input2.height;
|
||||
const int width = (input1.width < input2.width) ? input1.width : input2.width;
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
output.resize(height * width);
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
if (input1[i].intensity == 1 || input2[i].intensity == 1)
|
||||
output[i].intensity = 1;
|
||||
else
|
||||
output[i].intensity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::intersectionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2)
|
||||
{
|
||||
const int height = (input1.height < input2.height) ? input1.height : input2.height;
|
||||
const int width = (input1.width < input2.width) ? input1.width : input2.width;
|
||||
output.width = width;
|
||||
output.height = height;
|
||||
output.resize(height * width);
|
||||
|
||||
for (std::size_t i = 0; i < output.size(); ++i) {
|
||||
if (input1[i].intensity == 1 && input2[i].intensity == 1)
|
||||
output[i].intensity = 1;
|
||||
else
|
||||
output[i].intensity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::structuringElementCircular(pcl::PointCloud<PointT>& kernel,
|
||||
const int radius)
|
||||
{
|
||||
const int dim = 2 * radius;
|
||||
kernel.height = dim;
|
||||
kernel.width = dim;
|
||||
kernel.resize(dim * dim);
|
||||
|
||||
for (int i = 0; i < dim; i++) {
|
||||
for (int j = 0; j < dim; j++) {
|
||||
if (((i - radius) * (i - radius) + (j - radius) * (j - radius)) < radius * radius)
|
||||
kernel(j, i).intensity = 1;
|
||||
else
|
||||
kernel(j, i).intensity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::structuringElementRectangle(pcl::PointCloud<PointT>& kernel,
|
||||
const int height,
|
||||
const int width)
|
||||
{
|
||||
kernel.height = height;
|
||||
kernel.width = width;
|
||||
kernel.resize(height * width);
|
||||
for (std::size_t i = 0; i < kernel.size(); ++i)
|
||||
kernel[i].intensity = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
template <typename PointT>
|
||||
void
|
||||
pcl::Morphology<PointT>::setStructuringElement(
|
||||
const PointCloudInPtr& structuring_element)
|
||||
{
|
||||
structuring_element_ = structuring_element;
|
||||
}
|
||||
|
||||
#endif // PCL_2D_MORPHOLOGY_HPP_
|
||||
239
deps_install/include/pcl-1.10/pcl/2d/kernel.h
Executable file
239
deps_install/include/pcl-1.10/pcl/2d/kernel.h
Executable file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
namespace pcl {
|
||||
|
||||
template <typename PointT>
|
||||
class kernel {
|
||||
public:
|
||||
/// Different types of kernels available.
|
||||
enum KERNEL_ENUM {
|
||||
SOBEL_X, //!< SOBEL_X
|
||||
SOBEL_Y, //!< SOBEL_Y
|
||||
PREWITT_X, //!< PREWITT_X
|
||||
PREWITT_Y, //!< PREWITT_Y
|
||||
ROBERTS_X, //!< ROBERTS_X
|
||||
ROBERTS_Y, //!< ROBERTS_Y
|
||||
LOG, //!< LOG
|
||||
DERIVATIVE_CENTRAL_X, //!< DERIVATIVE_CENTRAL_X
|
||||
DERIVATIVE_FORWARD_X, //!< DERIVATIVE_FORWARD_X
|
||||
DERIVATIVE_BACKWARD_X, //!< DERIVATIVE_BACKWARD_X
|
||||
DERIVATIVE_CENTRAL_Y, //!< DERIVATIVE_CENTRAL_Y
|
||||
DERIVATIVE_FORWARD_Y, //!< DERIVATIVE_FORWARD_Y
|
||||
DERIVATIVE_BACKWARD_Y, //!< DERIVATIVE_BACKWARD_Y
|
||||
GAUSSIAN //!< GAUSSIAN
|
||||
};
|
||||
|
||||
int kernel_size_;
|
||||
float sigma_;
|
||||
KERNEL_ENUM kernel_type_;
|
||||
|
||||
kernel() : kernel_size_(3), sigma_(1.0), kernel_type_(GAUSSIAN) {}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* Helper function which returns the kernel selected by the kernel_type_ enum
|
||||
*/
|
||||
void
|
||||
fetchKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_
|
||||
*/
|
||||
void
|
||||
gaussianKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* Laplacian of Gaussian kernel with size (kernel_size_ x kernel_size_) and variance
|
||||
* sigma_
|
||||
*/
|
||||
void
|
||||
loGKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 3x3 Sobel kernel in the X direction
|
||||
*/
|
||||
void
|
||||
sobelKernelX(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 3x3 Prewitt kernel in the X direction
|
||||
*/
|
||||
void
|
||||
prewittKernelX(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 2x2 Roberts kernel in the X direction
|
||||
*/
|
||||
void
|
||||
robertsKernelX(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 3x3 Sobel kernel in the Y direction
|
||||
*/
|
||||
void
|
||||
sobelKernelY(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 3x3 Prewitt kernel in the Y direction
|
||||
*/
|
||||
void
|
||||
prewittKernelY(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* 2x2 Roberts kernel in the Y direction
|
||||
*/
|
||||
void
|
||||
robertsKernelY(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [-1 0 1]
|
||||
*/
|
||||
void
|
||||
derivativeXCentralKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [-1 0 1]'
|
||||
*/
|
||||
void
|
||||
derivativeYCentralKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [0 -1 1]
|
||||
*/
|
||||
void
|
||||
derivativeXForwardKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [0 -1 1]'
|
||||
*/
|
||||
void
|
||||
derivativeYForwardKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [-1 1 0]
|
||||
*/
|
||||
void
|
||||
derivativeXBackwardKernel(pcl::PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel Kernel point cloud passed by reference
|
||||
*
|
||||
* kernel [-1 1 0]'
|
||||
*/
|
||||
void
|
||||
derivativeYBackwardKernel(PointCloud<PointT>& kernel);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel_type enum indicating the kernel type wanted
|
||||
*
|
||||
* select the kernel type.
|
||||
*/
|
||||
void
|
||||
setKernelType(KERNEL_ENUM kernel_type);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel_size kernel of size kernel_size x kernel_size is created(LoG and
|
||||
* Gaussian only)
|
||||
*
|
||||
* Setter function for kernel_size_
|
||||
*/
|
||||
void
|
||||
setKernelSize(int kernel_size);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param kernel_sigma variance of the Gaussian or LoG kernels.
|
||||
*
|
||||
* Setter function for kernel_sigma_
|
||||
*/
|
||||
void
|
||||
setKernelSigma(float kernel_sigma);
|
||||
};
|
||||
|
||||
} // namespace pcl
|
||||
|
||||
#include <pcl/2d/impl/kernel.hpp>
|
||||
206
deps_install/include/pcl-1.10/pcl/2d/morphology.h
Executable file
206
deps_install/include/pcl-1.10/pcl/2d/morphology.h
Executable file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/pcl_base.h>
|
||||
|
||||
namespace pcl {
|
||||
|
||||
template <typename PointT>
|
||||
class Morphology : public PCLBase<PointT> {
|
||||
private:
|
||||
using PointCloudIn = pcl::PointCloud<PointT>;
|
||||
using PointCloudInPtr = typename PointCloudIn::Ptr;
|
||||
|
||||
PointCloudInPtr structuring_element_;
|
||||
|
||||
public:
|
||||
using PCLBase<PointT>::input_;
|
||||
|
||||
Morphology() {}
|
||||
|
||||
/** \brief This function performs erosion followed by dilation.
|
||||
* It is useful for removing noise in the form of small blobs and patches.
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
openingBinary(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief This function performs dilation followed by erosion.
|
||||
* It is useful for filling up (holes/cracks/small discontinuities) in a binary
|
||||
* segmented region
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
closingBinary(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Binary dilation is similar to a logical disjunction of sets.
|
||||
* At each pixel having value 1, if for all pixels in the structuring element having
|
||||
* value 1, the corresponding pixels in the input image are also 1, the center pixel
|
||||
* is set to 1. Otherwise, it is set to 0.
|
||||
*
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
erosionBinary(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Binary erosion is similar to a logical addition of sets.
|
||||
* At each pixel having value 1, if at least one pixel in the structuring element is
|
||||
* 1 and the corresponding point in the input image is 1, the center pixel is set
|
||||
* to 1. Otherwise, it is set to 0.
|
||||
*
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
dilationBinary(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Grayscale erosion followed by dilation.
|
||||
* This is used to remove small bright artifacts from the image. Large bright objects
|
||||
* are relatively undisturbed.
|
||||
*
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
openingGray(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Grayscale dilation followed by erosion.
|
||||
* This is used to remove small dark artifacts from the image. Bright features or
|
||||
* large dark features are relatively undisturbed.
|
||||
*
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
closingGray(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Takes the min of the pixels where kernel is 1
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
erosionGray(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Takes the max of the pixels where kernel is 1
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
dilationGray(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/** \brief Set operation
|
||||
* output = input1 - input2
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
* \param[in] input1
|
||||
* \param[in] input2
|
||||
*/
|
||||
void
|
||||
subtractionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2);
|
||||
|
||||
/** \brief Set operation
|
||||
* \f$output = input1 \cup input2\f$
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
* \param[in] input1
|
||||
* \param[in] input2
|
||||
*/
|
||||
void
|
||||
unionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2);
|
||||
|
||||
/** \brief Set operation \f$ output = input1 \cap input2 \f$
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
* \param[in] input1
|
||||
* \param[in] input2
|
||||
*/
|
||||
void
|
||||
intersectionBinary(pcl::PointCloud<PointT>& output,
|
||||
const pcl::PointCloud<PointT>& input1,
|
||||
const pcl::PointCloud<PointT>& input2);
|
||||
|
||||
/** \brief Creates a circular structing element. The size of the kernel created is
|
||||
* 2*radius x 2*radius. Center of the structuring element is the center of the circle.
|
||||
* All values lying on the circle are 1 and the others are 0.
|
||||
*
|
||||
* \param[out] kernel structuring element kernel passed by reference
|
||||
* \param[in] radius Radius of the circular structuring element.
|
||||
*/
|
||||
void
|
||||
structuringElementCircular(pcl::PointCloud<PointT>& kernel, const int radius);
|
||||
|
||||
/** \brief Creates a rectangular structing element of size height x width. *
|
||||
* All values are 1.
|
||||
*
|
||||
* \param[out] kernel structuring element kernel passed by reference
|
||||
* \param[in] height height number of rows in the structuring element
|
||||
* \param[in] width number of columns in the structuring element
|
||||
*
|
||||
*/
|
||||
void
|
||||
structuringElementRectangle(pcl::PointCloud<PointT>& kernel,
|
||||
const int height,
|
||||
const int width);
|
||||
|
||||
enum MORPHOLOGICAL_OPERATOR_TYPE {
|
||||
EROSION_GRAY,
|
||||
DILATION_GRAY,
|
||||
OPENING_GRAY,
|
||||
CLOSING_GRAY,
|
||||
EROSION_BINARY,
|
||||
DILATION_BINARY,
|
||||
OPENING_BINARY,
|
||||
CLOSING_BINARY
|
||||
};
|
||||
|
||||
MORPHOLOGICAL_OPERATOR_TYPE operator_type;
|
||||
|
||||
/**
|
||||
* \param[out] output Output point cloud passed by reference
|
||||
*/
|
||||
void
|
||||
applyMorphologicalOperation(pcl::PointCloud<PointT>& output);
|
||||
|
||||
/**
|
||||
* \param[in] structuring_element The structuring element to be used for the
|
||||
* morphological operation
|
||||
*/
|
||||
void
|
||||
setStructuringElement(const PointCloudInPtr& structuring_element);
|
||||
};
|
||||
|
||||
} // namespace pcl
|
||||
|
||||
#include <pcl/2d/impl/morphology.hpp>
|
||||
43
deps_install/include/pcl-1.10/pcl/ModelCoefficients.h
Executable file
43
deps_install/include/pcl-1.10/pcl/ModelCoefficients.h
Executable file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
// Include the correct Header path here
|
||||
#include <pcl/PCLHeader.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct ModelCoefficients
|
||||
{
|
||||
ModelCoefficients ()
|
||||
{
|
||||
}
|
||||
|
||||
::pcl::PCLHeader header;
|
||||
|
||||
std::vector<float> values;
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr< ::pcl::ModelCoefficients>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::ModelCoefficients>;
|
||||
}; // struct ModelCoefficients
|
||||
|
||||
using ModelCoefficientsPtr = ModelCoefficients::Ptr;
|
||||
using ModelCoefficientsConstPtr = ModelCoefficients::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::ModelCoefficients & v)
|
||||
{
|
||||
s << "header: " << std::endl;
|
||||
s << v.header;
|
||||
s << "values[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.values.size (); ++i)
|
||||
{
|
||||
s << " values[" << i << "]: ";
|
||||
s << " " << v.values[i] << std::endl;
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
} // namespace pcl
|
||||
43
deps_install/include/pcl-1.10/pcl/PCLHeader.h
Executable file
43
deps_install/include/pcl-1.10/pcl/PCLHeader.h
Executable file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <string> // for string
|
||||
#include <ostream> // for ostream
|
||||
|
||||
#include <pcl/make_shared.h> // for shared_ptr
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct PCLHeader
|
||||
{
|
||||
/** \brief Sequence number */
|
||||
std::uint32_t seq = 0;
|
||||
/** \brief A timestamp associated with the time when the data was acquired
|
||||
*
|
||||
* The value represents microseconds since 1970-01-01 00:00:00 (the UNIX epoch).
|
||||
*/
|
||||
std::uint64_t stamp = 0;
|
||||
/** \brief Coordinate frame ID */
|
||||
std::string frame_id;
|
||||
|
||||
using Ptr = shared_ptr<PCLHeader>;
|
||||
using ConstPtr = shared_ptr<const PCLHeader>;
|
||||
}; // struct PCLHeader
|
||||
|
||||
using HeaderPtr = PCLHeader::Ptr;
|
||||
using HeaderConstPtr = PCLHeader::ConstPtr;
|
||||
|
||||
inline std::ostream& operator << (std::ostream& out, const PCLHeader &h)
|
||||
{
|
||||
out << "seq: " << h.seq;
|
||||
out << " stamp: " << h.stamp;
|
||||
out << " frame_id: " << h.frame_id << std::endl;
|
||||
return (out);
|
||||
}
|
||||
|
||||
inline bool operator== (const PCLHeader &lhs, const PCLHeader &rhs)
|
||||
{
|
||||
return (&lhs == &rhs) ||
|
||||
(lhs.seq == rhs.seq && lhs.stamp == rhs.stamp && lhs.frame_id == rhs.frame_id);
|
||||
}
|
||||
|
||||
} // namespace pcl
|
||||
53
deps_install/include/pcl-1.10/pcl/PCLImage.h
Executable file
53
deps_install/include/pcl-1.10/pcl/PCLImage.h
Executable file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include <string> // for string
|
||||
#include <vector> // for vector
|
||||
#include <ostream> // for ostream
|
||||
|
||||
#include <pcl/PCLHeader.h> // for PCLHeader
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct PCLImage
|
||||
{
|
||||
::pcl::PCLHeader header;
|
||||
|
||||
std::uint32_t height = 0;
|
||||
std::uint32_t width = 0;
|
||||
std::string encoding;
|
||||
|
||||
std::uint8_t is_bigendian = 0;
|
||||
std::uint32_t step = 0;
|
||||
|
||||
std::vector<std::uint8_t> data;
|
||||
|
||||
using Ptr = shared_ptr< ::pcl::PCLImage>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::PCLImage>;
|
||||
}; // struct PCLImage
|
||||
|
||||
using PCLImagePtr = PCLImage::Ptr;
|
||||
using PCLImageConstPtr = PCLImage::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLImage & v)
|
||||
{
|
||||
s << "header: " << std::endl;
|
||||
s << v.header;
|
||||
s << "height: ";
|
||||
s << " " << v.height << std::endl;
|
||||
s << "width: ";
|
||||
s << " " << v.width << std::endl;
|
||||
s << "encoding: ";
|
||||
s << " " << v.encoding << std::endl;
|
||||
s << "is_bigendian: ";
|
||||
s << " " << v.is_bigendian << std::endl;
|
||||
s << "step: ";
|
||||
s << " " << v.step << std::endl;
|
||||
s << "data[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.data.size (); ++i)
|
||||
{
|
||||
s << " data[" << i << "]: ";
|
||||
s << " " << v.data[i] << std::endl;
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
} // namespace pcl
|
||||
124
deps_install/include/pcl-1.10/pcl/PCLPointCloud2.h
Executable file
124
deps_install/include/pcl-1.10/pcl/PCLPointCloud2.h
Executable file
@@ -0,0 +1,124 @@
|
||||
#pragma once
|
||||
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/predef/other/endian.h>
|
||||
|
||||
#include <pcl/PCLHeader.h>
|
||||
#include <pcl/PCLPointField.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
|
||||
struct PCL_EXPORTS PCLPointCloud2
|
||||
{
|
||||
::pcl::PCLHeader header;
|
||||
|
||||
std::uint32_t height = 0;
|
||||
std::uint32_t width = 0;
|
||||
|
||||
std::vector<::pcl::PCLPointField> fields;
|
||||
|
||||
static_assert(BOOST_ENDIAN_BIG_BYTE || BOOST_ENDIAN_LITTLE_BYTE, "unable to determine system endianness");
|
||||
std::uint8_t is_bigendian = BOOST_ENDIAN_BIG_BYTE;
|
||||
std::uint32_t point_step = 0;
|
||||
std::uint32_t row_step = 0;
|
||||
|
||||
std::vector<std::uint8_t> data;
|
||||
|
||||
std::uint8_t is_dense = 0;
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr< ::pcl::PCLPointCloud2>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::PCLPointCloud2>;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** \brief Inplace concatenate two pcl::PCLPointCloud2
|
||||
*
|
||||
* IFF the layout of all the fields in both the clouds is the same, this command
|
||||
* doesn't remove any fields named "_" (aka marked as skip). For comparison of field
|
||||
* names, "rgb" and "rgba" are considered equivalent
|
||||
* However, if the order and/or number of non-skip fields is different, the skip fields
|
||||
* are dropped and non-skip fields copied selectively.
|
||||
* This function returns an error if
|
||||
* * the total number of non-skip fields is different
|
||||
* * the non-skip field names are named differently (excluding "rbg{a}") in serial order
|
||||
* * the endian-ness of both clouds is different
|
||||
* \param[in,out] cloud1 the first input and output point cloud dataset
|
||||
* \param[in] cloud2 the second input point cloud dataset
|
||||
* \return true if successful, false if failed (e.g., name/number of fields differs)
|
||||
*/
|
||||
static bool
|
||||
concatenate (pcl::PCLPointCloud2 &cloud1, const pcl::PCLPointCloud2 &cloud2);
|
||||
|
||||
/** \brief Concatenate two pcl::PCLPointCloud2
|
||||
* \param[in] cloud1 the first input point cloud dataset
|
||||
* \param[in] cloud2 the second input point cloud dataset
|
||||
* \param[out] cloud_out the resultant output point cloud dataset
|
||||
* \return true if successful, false if failed (e.g., name/number of fields differs)
|
||||
*/
|
||||
static bool
|
||||
concatenate (const PCLPointCloud2 &cloud1,
|
||||
const PCLPointCloud2 &cloud2,
|
||||
PCLPointCloud2 &cloud_out)
|
||||
{
|
||||
cloud_out = cloud1;
|
||||
return concatenate(cloud_out, cloud2);
|
||||
}
|
||||
|
||||
/** \brief Add a point cloud to the current cloud.
|
||||
* \param[in] rhs the cloud to add to the current cloud
|
||||
* \return the new cloud as a concatenation of the current cloud and the new given cloud
|
||||
*/
|
||||
PCLPointCloud2&
|
||||
operator += (const PCLPointCloud2& rhs);
|
||||
|
||||
/** \brief Add a point cloud to another cloud.
|
||||
* \param[in] rhs the cloud to add to the current cloud
|
||||
* \return the new cloud as a concatenation of the current cloud and the new given cloud
|
||||
*/
|
||||
inline PCLPointCloud2
|
||||
operator + (const PCLPointCloud2& rhs)
|
||||
{
|
||||
return (PCLPointCloud2 (*this) += rhs);
|
||||
}
|
||||
}; // struct PCLPointCloud2
|
||||
|
||||
using PCLPointCloud2Ptr = PCLPointCloud2::Ptr;
|
||||
using PCLPointCloud2ConstPtr = PCLPointCloud2::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLPointCloud2 &v)
|
||||
{
|
||||
s << "header: " << std::endl;
|
||||
s << v.header;
|
||||
s << "height: ";
|
||||
s << " " << v.height << std::endl;
|
||||
s << "width: ";
|
||||
s << " " << v.width << std::endl;
|
||||
s << "fields[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.fields.size (); ++i)
|
||||
{
|
||||
s << " fields[" << i << "]: ";
|
||||
s << std::endl;
|
||||
s << " " << v.fields[i] << std::endl;
|
||||
}
|
||||
s << "is_bigendian: ";
|
||||
s << " " << v.is_bigendian << std::endl;
|
||||
s << "point_step: ";
|
||||
s << " " << v.point_step << std::endl;
|
||||
s << "row_step: ";
|
||||
s << " " << v.row_step << std::endl;
|
||||
s << "data[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.data.size (); ++i)
|
||||
{
|
||||
s << " data[" << i << "]: ";
|
||||
s << " " << v.data[i] << std::endl;
|
||||
}
|
||||
s << "is_dense: ";
|
||||
s << " " << v.is_dense << std::endl;
|
||||
|
||||
return (s);
|
||||
}
|
||||
|
||||
} // namespace pcl
|
||||
47
deps_install/include/pcl-1.10/pcl/PCLPointField.h
Executable file
47
deps_install/include/pcl-1.10/pcl/PCLPointField.h
Executable file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <string> // for string
|
||||
#include <ostream> // for ostream
|
||||
|
||||
#include <pcl/pcl_macros.h> // for shared_ptr
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct PCLPointField
|
||||
{
|
||||
std::string name;
|
||||
|
||||
std::uint32_t offset = 0;
|
||||
std::uint8_t datatype = 0;
|
||||
std::uint32_t count = 0;
|
||||
|
||||
enum PointFieldTypes { INT8 = 1,
|
||||
UINT8 = 2,
|
||||
INT16 = 3,
|
||||
UINT16 = 4,
|
||||
INT32 = 5,
|
||||
UINT32 = 6,
|
||||
FLOAT32 = 7,
|
||||
FLOAT64 = 8 };
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr< ::pcl::PCLPointField>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::PCLPointField>;
|
||||
}; // struct PCLPointField
|
||||
|
||||
using PCLPointFieldPtr = PCLPointField::Ptr;
|
||||
using PCLPointFieldConstPtr = PCLPointField::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::PCLPointField & v)
|
||||
{
|
||||
s << "name: ";
|
||||
s << " " << v.name << std::endl;
|
||||
s << "offset: ";
|
||||
s << " " << v.offset << std::endl;
|
||||
s << "datatype: ";
|
||||
s << " " << v.datatype << std::endl;
|
||||
s << "count: ";
|
||||
s << " " << v.count << std::endl;
|
||||
return (s);
|
||||
}
|
||||
} // namespace pcl
|
||||
41
deps_install/include/pcl-1.10/pcl/PointIndices.h
Executable file
41
deps_install/include/pcl-1.10/pcl/PointIndices.h
Executable file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
// Include the correct Header path here
|
||||
#include <pcl/PCLHeader.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct PointIndices
|
||||
{
|
||||
PointIndices ()
|
||||
{}
|
||||
|
||||
::pcl::PCLHeader header;
|
||||
|
||||
std::vector<int> indices;
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr< ::pcl::PointIndices>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::PointIndices>;
|
||||
}; // struct PointIndices
|
||||
|
||||
using PointIndicesPtr = PointIndices::Ptr;
|
||||
using PointIndicesConstPtr = PointIndices::ConstPtr;
|
||||
|
||||
inline std::ostream& operator << (std::ostream& s, const ::pcl::PointIndices &v)
|
||||
{
|
||||
s << "header: " << std::endl;
|
||||
s << " " << v.header;
|
||||
s << "indices[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.indices.size (); ++i)
|
||||
{
|
||||
s << " indices[" << i << "]: ";
|
||||
s << " " << v.indices[i] << std::endl;
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
} // namespace pcl
|
||||
119
deps_install/include/pcl-1.10/pcl/PolygonMesh.h
Executable file
119
deps_install/include/pcl-1.10/pcl/PolygonMesh.h
Executable file
@@ -0,0 +1,119 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
// Include the correct Header path here
|
||||
#include <pcl/PCLHeader.h>
|
||||
#include <pcl/PCLPointCloud2.h>
|
||||
#include <pcl/Vertices.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
struct PolygonMesh
|
||||
{
|
||||
PolygonMesh ()
|
||||
{}
|
||||
|
||||
::pcl::PCLHeader header;
|
||||
|
||||
::pcl::PCLPointCloud2 cloud;
|
||||
|
||||
std::vector< ::pcl::Vertices> polygons;
|
||||
|
||||
/** \brief Inplace concatenate two pcl::PolygonMesh
|
||||
* \param[in,out] mesh1 the first input and output mesh
|
||||
* \param[in] mesh2 the second input mesh
|
||||
* \return true if successful, false otherwise (unexpected error)
|
||||
*/
|
||||
static bool
|
||||
concatenate (pcl::PolygonMesh &mesh1, const pcl::PolygonMesh &mesh2)
|
||||
{
|
||||
bool success = pcl::PCLPointCloud2::concatenate(mesh1.cloud, mesh2.cloud);
|
||||
if (success == false) {
|
||||
return false;
|
||||
}
|
||||
// Make the resultant polygon mesh take the newest stamp
|
||||
mesh1.header.stamp = std::max(mesh1.header.stamp, mesh2.header.stamp);
|
||||
|
||||
const auto point_offset = mesh1.cloud.width * mesh1.cloud.height;
|
||||
std::transform(mesh2.polygons.begin (),
|
||||
mesh2.polygons.end (),
|
||||
std::back_inserter (mesh1.polygons),
|
||||
[point_offset](auto polygon)
|
||||
{
|
||||
std::transform(polygon.vertices.begin (),
|
||||
polygon.vertices.end (),
|
||||
polygon.vertices.begin (),
|
||||
[point_offset](auto& point_idx)
|
||||
{
|
||||
return point_idx + point_offset;
|
||||
});
|
||||
return polygon;
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Concatenate two pcl::PCLPointCloud2
|
||||
* \param[in] mesh1 the first input mesh
|
||||
* \param[in] mesh2 the second input mesh
|
||||
* \param[out] mesh_out the resultant output mesh
|
||||
* \return true if successful, false otherwise (unexpected error)
|
||||
*/
|
||||
static bool
|
||||
concatenate (const PolygonMesh &mesh1,
|
||||
const PolygonMesh &mesh2,
|
||||
PolygonMesh &mesh_out)
|
||||
{
|
||||
mesh_out = mesh1;
|
||||
return concatenate(mesh_out, mesh2);
|
||||
}
|
||||
|
||||
/** \brief Add another polygon mesh to the current mesh.
|
||||
* \param[in] rhs the mesh to add to the current mesh
|
||||
* \return the new mesh as a concatenation of the current mesh and the new given mesh
|
||||
*/
|
||||
inline PolygonMesh&
|
||||
operator += (const PolygonMesh& rhs)
|
||||
{
|
||||
concatenate((*this), rhs);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/** \brief Add a polygon mesh to another mesh.
|
||||
* \param[in] rhs the mesh to add to the current mesh
|
||||
* \return the new mesh as a concatenation of the current mesh and the new given mesh
|
||||
*/
|
||||
inline const PolygonMesh
|
||||
operator + (const PolygonMesh& rhs)
|
||||
{
|
||||
return (PolygonMesh (*this) += rhs);
|
||||
}
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr< ::pcl::PolygonMesh>;
|
||||
using ConstPtr = shared_ptr<const ::pcl::PolygonMesh>;
|
||||
}; // struct PolygonMesh
|
||||
|
||||
using PolygonMeshPtr = PolygonMesh::Ptr;
|
||||
using PolygonMeshConstPtr = PolygonMesh::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::PolygonMesh &v)
|
||||
{
|
||||
s << "header: " << std::endl;
|
||||
s << v.header;
|
||||
s << "cloud: " << std::endl;
|
||||
s << v.cloud;
|
||||
s << "polygons[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.polygons.size (); ++i)
|
||||
{
|
||||
s << " polygons[" << i << "]: " << std::endl;
|
||||
s << v.polygons[i];
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
} // namespace pcl
|
||||
105
deps_install/include/pcl-1.10/pcl/TextureMesh.h
Executable file
105
deps_install/include/pcl-1.10/pcl/TextureMesh.h
Executable file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2011, Willow Garage, Inc.
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <string>
|
||||
#include <pcl/PCLPointCloud2.h>
|
||||
#include <pcl/Vertices.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \author Khai Tran */
|
||||
struct TexMaterial
|
||||
{
|
||||
struct RGB
|
||||
{
|
||||
float r = 0;
|
||||
float g = 0;
|
||||
float b = 0;
|
||||
}; //RGB
|
||||
|
||||
/** \brief Texture name. */
|
||||
std::string tex_name;
|
||||
|
||||
/** \brief Texture file. */
|
||||
std::string tex_file;
|
||||
|
||||
/** \brief Defines the ambient color of the material to be (r,g,b). */
|
||||
RGB tex_Ka;
|
||||
|
||||
/** \brief Defines the diffuse color of the material to be (r,g,b). */
|
||||
RGB tex_Kd;
|
||||
|
||||
/** \brief Defines the specular color of the material to be (r,g,b). This color shows up in highlights. */
|
||||
RGB tex_Ks;
|
||||
|
||||
/** \brief Defines the transparency of the material to be alpha. */
|
||||
float tex_d;
|
||||
|
||||
/** \brief Defines the shininess of the material to be s. */
|
||||
float tex_Ns;
|
||||
|
||||
/** \brief Denotes the illumination model used by the material.
|
||||
*
|
||||
* illum = 1 indicates a flat material with no specular highlights, so the value of Ks is not used.
|
||||
* illum = 2 denotes the presence of specular highlights, and so a specification for Ks is required.
|
||||
*/
|
||||
int tex_illum;
|
||||
}; // TexMaterial
|
||||
|
||||
/** \author Khai Tran */
|
||||
struct TextureMesh
|
||||
{
|
||||
pcl::PCLPointCloud2 cloud;
|
||||
pcl::PCLHeader header;
|
||||
|
||||
|
||||
std::vector<std::vector<pcl::Vertices> > tex_polygons; // polygon which is mapped with specific texture defined in TexMaterial
|
||||
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > tex_coordinates; // UV coordinates
|
||||
std::vector<pcl::TexMaterial> tex_materials; // define texture material
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr<pcl::TextureMesh>;
|
||||
using ConstPtr = shared_ptr<const pcl::TextureMesh>;
|
||||
}; // struct TextureMesh
|
||||
|
||||
using TextureMeshPtr = TextureMesh::Ptr;
|
||||
using TextureMeshConstPtr = TextureMesh::ConstPtr;
|
||||
} // namespace pcl
|
||||
40
deps_install/include/pcl-1.10/pcl/Vertices.h
Executable file
40
deps_install/include/pcl-1.10/pcl/Vertices.h
Executable file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <pcl/pcl_macros.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Describes a set of vertices in a polygon mesh, by basically
|
||||
* storing an array of indices.
|
||||
*/
|
||||
struct Vertices
|
||||
{
|
||||
Vertices ()
|
||||
{}
|
||||
|
||||
std::vector<std::uint32_t> vertices;
|
||||
|
||||
public:
|
||||
using Ptr = shared_ptr<Vertices>;
|
||||
using ConstPtr = shared_ptr<const Vertices>;
|
||||
}; // struct Vertices
|
||||
|
||||
|
||||
using VerticesPtr = Vertices::Ptr;
|
||||
using VerticesConstPtr = Vertices::ConstPtr;
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& s, const ::pcl::Vertices & v)
|
||||
{
|
||||
s << "vertices[]" << std::endl;
|
||||
for (std::size_t i = 0; i < v.vertices.size (); ++i)
|
||||
{
|
||||
s << " vertices[" << i << "]: ";
|
||||
s << " " << v.vertices[i] << std::endl;
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
} // namespace pcl
|
||||
190
deps_install/include/pcl-1.10/pcl/cloud_iterator.h
Executable file
190
deps_install/include/pcl-1.10/pcl/cloud_iterator.h
Executable file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/PointIndices.h>
|
||||
#include <pcl/correspondence.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Iterator class for point clouds with or without given indices
|
||||
* \author Suat Gedikli
|
||||
*/
|
||||
template <typename PointT>
|
||||
class CloudIterator
|
||||
{
|
||||
public:
|
||||
CloudIterator (PointCloud<PointT>& cloud);
|
||||
|
||||
CloudIterator (PointCloud<PointT>& cloud, const std::vector<int>& indices);
|
||||
|
||||
CloudIterator (PointCloud<PointT>& cloud, const PointIndices& indices);
|
||||
|
||||
CloudIterator (PointCloud<PointT>& cloud, const Correspondences& corrs, bool source);
|
||||
|
||||
~CloudIterator ();
|
||||
|
||||
void operator ++ ();
|
||||
|
||||
void operator ++ (int);
|
||||
|
||||
PointT& operator* () const;
|
||||
|
||||
PointT* operator-> () const;
|
||||
|
||||
unsigned getCurrentPointIndex () const;
|
||||
|
||||
unsigned getCurrentIndex () const;
|
||||
|
||||
/** \brief Size of the range the iterator is going through. Depending on how the CloudIterator was constructed this is the size of the cloud or indices/correspondences. */
|
||||
std::size_t size () const;
|
||||
|
||||
void reset ();
|
||||
|
||||
bool isValid () const;
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return isValid ();
|
||||
}
|
||||
private:
|
||||
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
virtual ~Iterator () {}
|
||||
|
||||
virtual void operator ++ () = 0;
|
||||
|
||||
virtual void operator ++ (int) = 0;
|
||||
|
||||
virtual PointT& operator* () const = 0;
|
||||
|
||||
virtual PointT* operator-> () const = 0;
|
||||
|
||||
virtual unsigned getCurrentPointIndex () const = 0;
|
||||
|
||||
virtual unsigned getCurrentIndex () const = 0;
|
||||
|
||||
/** \brief Size of the range the iterator is going through. Depending on how the CloudIterator was constructed this is the size of the cloud or indices/correspondences. */
|
||||
virtual std::size_t size () const = 0;
|
||||
|
||||
virtual void reset () = 0;
|
||||
|
||||
virtual bool isValid () const = 0;
|
||||
};
|
||||
Iterator* iterator_;
|
||||
};
|
||||
|
||||
/** \brief Iterator class for point clouds with or without given indices
|
||||
* \author Suat Gedikli
|
||||
*/
|
||||
template <typename PointT>
|
||||
class ConstCloudIterator
|
||||
{
|
||||
public:
|
||||
ConstCloudIterator (const PointCloud<PointT>& cloud);
|
||||
|
||||
ConstCloudIterator (const PointCloud<PointT>& cloud, const std::vector<int>& indices);
|
||||
|
||||
ConstCloudIterator (const PointCloud<PointT>& cloud, const PointIndices& indices);
|
||||
|
||||
ConstCloudIterator (const PointCloud<PointT>& cloud, const Correspondences& corrs, bool source);
|
||||
|
||||
~ConstCloudIterator ();
|
||||
|
||||
void operator ++ ();
|
||||
|
||||
void operator ++ (int);
|
||||
|
||||
const PointT& operator* () const;
|
||||
|
||||
const PointT* operator-> () const;
|
||||
|
||||
unsigned getCurrentPointIndex () const;
|
||||
|
||||
unsigned getCurrentIndex () const;
|
||||
|
||||
/** \brief Size of the range the iterator is going through. Depending on how the ConstCloudIterator was constructed this is the size of the cloud or indices/correspondences. */
|
||||
std::size_t size () const;
|
||||
|
||||
void reset ();
|
||||
|
||||
bool isValid () const;
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return isValid ();
|
||||
}
|
||||
private:
|
||||
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
virtual ~Iterator () {}
|
||||
|
||||
virtual void operator ++ () = 0;
|
||||
|
||||
virtual void operator ++ (int) = 0;
|
||||
|
||||
virtual const PointT& operator* () const = 0;
|
||||
|
||||
virtual const PointT* operator-> () const = 0;
|
||||
|
||||
virtual unsigned getCurrentPointIndex () const = 0;
|
||||
|
||||
virtual unsigned getCurrentIndex () const = 0;
|
||||
|
||||
/** \brief Size of the range the iterator is going through. Depending on how the ConstCloudIterator was constructed this is the size of the cloud or indices/correspondences. */
|
||||
virtual std::size_t size () const = 0;
|
||||
|
||||
virtual void reset () = 0;
|
||||
|
||||
virtual bool isValid () const = 0;
|
||||
};
|
||||
|
||||
class DefaultConstIterator;
|
||||
class ConstIteratorIdx;
|
||||
Iterator* iterator_;
|
||||
};
|
||||
|
||||
} // namespace pcl
|
||||
|
||||
#include <pcl/impl/cloud_iterator.hpp>
|
||||
86
deps_install/include/pcl-1.10/pcl/common/angles.h
Executable file
86
deps_install/include/pcl-1.10/pcl/common/angles.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2012, Willow Garage, Inc.
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* \file pcl/common/angles.h
|
||||
* Define standard C methods to do angle calculations
|
||||
* \ingroup common
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Convert an angle from radians to degrees
|
||||
* \param alpha the input angle (in radians)
|
||||
* \ingroup common
|
||||
*/
|
||||
inline float
|
||||
rad2deg (float alpha);
|
||||
|
||||
/** \brief Convert an angle from degrees to radians
|
||||
* \param alpha the input angle (in degrees)
|
||||
* \ingroup common
|
||||
*/
|
||||
inline float
|
||||
deg2rad (float alpha);
|
||||
|
||||
/** \brief Convert an angle from radians to degrees
|
||||
* \param alpha the input angle (in radians)
|
||||
* \ingroup common
|
||||
*/
|
||||
inline double
|
||||
rad2deg (double alpha);
|
||||
|
||||
/** \brief Convert an angle from degrees to radians
|
||||
* \param alpha the input angle (in degrees)
|
||||
* \ingroup common
|
||||
*/
|
||||
inline double
|
||||
deg2rad (double alpha);
|
||||
|
||||
/** \brief Normalize an angle to (-PI, PI]
|
||||
* \param alpha the input angle (in radians)
|
||||
* \ingroup common
|
||||
*/
|
||||
inline float
|
||||
normAngle (float alpha);
|
||||
}
|
||||
/*@}*/
|
||||
#include <pcl/common/impl/angles.hpp>
|
||||
142
deps_install/include/pcl-1.10/pcl/common/bivariate_polynomial.h
Executable file
142
deps_install/include/pcl-1.10/pcl/common/bivariate_polynomial.h
Executable file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2012, Willow Garage, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief This represents a bivariate polynomial and provides some functionality for it
|
||||
* \author Bastian Steder
|
||||
* \ingroup common
|
||||
*/
|
||||
template<typename real>
|
||||
class BivariatePolynomialT
|
||||
{
|
||||
public:
|
||||
//-----CONSTRUCTOR&DESTRUCTOR-----
|
||||
/** Constructor */
|
||||
BivariatePolynomialT (int new_degree=0);
|
||||
/** Copy constructor */
|
||||
BivariatePolynomialT (const BivariatePolynomialT& other);
|
||||
/** Destructor */
|
||||
~BivariatePolynomialT ();
|
||||
|
||||
//-----OPERATORS-----
|
||||
/** = operator */
|
||||
BivariatePolynomialT&
|
||||
operator= (const BivariatePolynomialT& other) { deepCopy (other); return *this;}
|
||||
|
||||
//-----METHODS-----
|
||||
/** Initialize members to default values */
|
||||
void
|
||||
setDegree (int new_degree);
|
||||
|
||||
/** How many parameters has a bivariate polynomial with this degree */
|
||||
unsigned int
|
||||
getNoOfParameters () const { return getNoOfParametersFromDegree (degree);}
|
||||
|
||||
/** Calculate the value of the polynomial at the given point */
|
||||
real
|
||||
getValue (real x, real y) const;
|
||||
|
||||
/** Calculate the gradient of this polynomial
|
||||
* If forceRecalc is false, it will do nothing when the gradient already exists */
|
||||
void
|
||||
calculateGradient (bool forceRecalc=false);
|
||||
|
||||
/** Calculate the value of the gradient at the given point */
|
||||
void
|
||||
getValueOfGradient (real x, real y, real& gradX, real& gradY);
|
||||
|
||||
/** Returns critical points of the polynomial. type can be 0=maximum, 1=minimum, or 2=saddle point
|
||||
* !!Currently only implemented for degree 2!! */
|
||||
void
|
||||
findCriticalPoints (std::vector<real>& x_values, std::vector<real>& y_values, std::vector<int>& types) const;
|
||||
|
||||
/** write as binary to a stream */
|
||||
void
|
||||
writeBinary (std::ostream& os) const;
|
||||
|
||||
/** write as binary into a file */
|
||||
void
|
||||
writeBinary (const char* filename) const;
|
||||
|
||||
/** read binary from a stream */
|
||||
void
|
||||
readBinary (std::istream& os);
|
||||
|
||||
/** read binary from a file */
|
||||
void
|
||||
readBinary (const char* filename);
|
||||
|
||||
/** How many parameters has a bivariate polynomial of the given degree */
|
||||
static unsigned int
|
||||
getNoOfParametersFromDegree (int n) { return ((n+2)* (n+1))/2;}
|
||||
|
||||
//-----VARIABLES-----
|
||||
int degree;
|
||||
real* parameters;
|
||||
BivariatePolynomialT<real>* gradient_x, * gradient_y;
|
||||
|
||||
protected:
|
||||
//-----METHODS-----
|
||||
/** Delete all members */
|
||||
void
|
||||
memoryCleanUp ();
|
||||
|
||||
/** Create a deep copy of the given polynomial */
|
||||
void
|
||||
deepCopy (const BivariatePolynomialT<real>& other);
|
||||
//-----VARIABLES-----
|
||||
};
|
||||
|
||||
template<typename real>
|
||||
std::ostream&
|
||||
operator<< (std::ostream& os, const BivariatePolynomialT<real>& p);
|
||||
|
||||
using BivariatePolynomiald = BivariatePolynomialT<double>;
|
||||
using BivariatePolynomial = BivariatePolynomialT<float>;
|
||||
|
||||
} // end namespace
|
||||
|
||||
#include <pcl/common/impl/bivariate_polynomial.hpp>
|
||||
55
deps_install/include/pcl-1.10/pcl/common/boost.h
Executable file
55
deps_install/include/pcl-1.10/pcl/common/boost.h
Executable file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2011, Willow Garage, Inc.
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
// Marking all Boost headers as system headers to remove warnings
|
||||
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/signals2.hpp>
|
||||
#include <boost/signals2/slot.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#endif
|
||||
1098
deps_install/include/pcl-1.10/pcl/common/centroid.h
Executable file
1098
deps_install/include/pcl-1.10/pcl/common/centroid.h
Executable file
File diff suppressed because it is too large
Load Diff
86
deps_install/include/pcl-1.10/pcl/common/colors.h
Executable file
86
deps_install/include/pcl-1.10/pcl/common/colors.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2014-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/pcl_macros.h>
|
||||
#include <pcl/point_types.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
|
||||
PCL_EXPORTS RGB
|
||||
getRandomColor (double min = 0.2, double max = 2.8);
|
||||
|
||||
enum ColorLUTName
|
||||
{
|
||||
/** Color lookup table consisting of 256 colors structured in a maximally
|
||||
* discontinuous manner. Generated using the method of Glasbey et al.
|
||||
* (see https://github.com/taketwo/glasbey) */
|
||||
LUT_GLASBEY,
|
||||
/** A perceptually uniform colormap created by Stéfan van der Walt and
|
||||
* Nathaniel Smith for the Python matplotlib library.
|
||||
* (see https://youtu.be/xAoljeRJ3lU for background and overview) */
|
||||
LUT_VIRIDIS,
|
||||
};
|
||||
|
||||
template <ColorLUTName T>
|
||||
class ColorLUT
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/** Get a color from the lookup table with a given id.
|
||||
*
|
||||
* The id should be less than the size of the LUT (see size()). */
|
||||
static RGB at (std::size_t color_id);
|
||||
|
||||
/** Get the number of colors in the lookup table.
|
||||
*
|
||||
* Note: the number of colors is different from the number of elements
|
||||
* in the lookup table (each color is defined by three bytes). */
|
||||
static std::size_t size ();
|
||||
|
||||
/** Get a raw pointer to the lookup table. */
|
||||
static const unsigned char* data ();
|
||||
|
||||
};
|
||||
|
||||
using GlasbeyLUT = ColorLUT<pcl::LUT_GLASBEY>;
|
||||
using ViridisLUT = ColorLUT<pcl::LUT_VIRIDIS>;
|
||||
|
||||
}
|
||||
205
deps_install/include/pcl-1.10/pcl/common/common.h
Executable file
205
deps_install/include/pcl-1.10/pcl/common/common.h
Executable file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/pcl_base.h>
|
||||
#include <cfloat>
|
||||
|
||||
/**
|
||||
* \file pcl/common/common.h
|
||||
* Define standard C methods and C++ classes that are common to all methods
|
||||
* \ingroup common
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Compute the smallest angle between two 3D vectors in radians (default) or degree.
|
||||
* \param v1 the first 3D vector (represented as a \a Eigen::Vector4f)
|
||||
* \param v2 the second 3D vector (represented as a \a Eigen::Vector4f)
|
||||
* \return the angle between v1 and v2 in radians or degrees
|
||||
* \note Handles rounding error for parallel and anti-parallel vectors
|
||||
* \ingroup common
|
||||
*/
|
||||
inline double
|
||||
getAngle3D (const Eigen::Vector4f &v1, const Eigen::Vector4f &v2, const bool in_degree = false);
|
||||
|
||||
/** \brief Compute the smallest angle between two 3D vectors in radians (default) or degree.
|
||||
* \param v1 the first 3D vector (represented as a \a Eigen::Vector3f)
|
||||
* \param v2 the second 3D vector (represented as a \a Eigen::Vector3f)
|
||||
* \param in_degree determine if angle should be in radians or degrees
|
||||
* \return the angle between v1 and v2 in radians or degrees
|
||||
* \ingroup common
|
||||
*/
|
||||
inline double
|
||||
getAngle3D (const Eigen::Vector3f &v1, const Eigen::Vector3f &v2, const bool in_degree = false);
|
||||
|
||||
|
||||
/** \brief Compute both the mean and the standard deviation of an array of values
|
||||
* \param values the array of values
|
||||
* \param mean the resultant mean of the distribution
|
||||
* \param stddev the resultant standard deviation of the distribution
|
||||
* \ingroup common
|
||||
*/
|
||||
inline void
|
||||
getMeanStd (const std::vector<float> &values, double &mean, double &stddev);
|
||||
|
||||
/** \brief Get a set of points residing in a box given its bounds
|
||||
* \param cloud the point cloud data message
|
||||
* \param min_pt the minimum bounds
|
||||
* \param max_pt the maximum bounds
|
||||
* \param indices the resultant set of point indices residing in the box
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getPointsInBox (const pcl::PointCloud<PointT> &cloud, Eigen::Vector4f &min_pt,
|
||||
Eigen::Vector4f &max_pt, std::vector<int> &indices);
|
||||
|
||||
/** \brief Get the point at maximum distance from a given point and a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param pivot_pt the point from where to compute the distance
|
||||
* \param max_pt the point in cloud that is the farthest point away from pivot_pt
|
||||
* \ingroup common
|
||||
*/
|
||||
template<typename PointT> inline void
|
||||
getMaxDistance (const pcl::PointCloud<PointT> &cloud, const Eigen::Vector4f &pivot_pt, Eigen::Vector4f &max_pt);
|
||||
|
||||
/** \brief Get the point at maximum distance from a given point and a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param indices the vector of point indices to use from \a cloud
|
||||
* \param pivot_pt the point from where to compute the distance
|
||||
* \param max_pt the point in cloud that is the farthest point away from pivot_pt
|
||||
* \ingroup common
|
||||
*/
|
||||
template<typename PointT> inline void
|
||||
getMaxDistance (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
|
||||
const Eigen::Vector4f &pivot_pt, Eigen::Vector4f &max_pt);
|
||||
|
||||
/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param min_pt the resultant minimum bounds
|
||||
* \param max_pt the resultant maximum bounds
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getMinMax3D (const pcl::PointCloud<PointT> &cloud, PointT &min_pt, PointT &max_pt);
|
||||
|
||||
/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param min_pt the resultant minimum bounds
|
||||
* \param max_pt the resultant maximum bounds
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getMinMax3D (const pcl::PointCloud<PointT> &cloud,
|
||||
Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);
|
||||
|
||||
/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param indices the vector of point indices to use from \a cloud
|
||||
* \param min_pt the resultant minimum bounds
|
||||
* \param max_pt the resultant maximum bounds
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
|
||||
Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);
|
||||
|
||||
/** \brief Get the minimum and maximum values on each of the 3 (x-y-z) dimensions in a given pointcloud
|
||||
* \param cloud the point cloud data message
|
||||
* \param indices the vector of point indices to use from \a cloud
|
||||
* \param min_pt the resultant minimum bounds
|
||||
* \param max_pt the resultant maximum bounds
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getMinMax3D (const pcl::PointCloud<PointT> &cloud, const pcl::PointIndices &indices,
|
||||
Eigen::Vector4f &min_pt, Eigen::Vector4f &max_pt);
|
||||
|
||||
/** \brief Compute the radius of a circumscribed circle for a triangle formed of three points pa, pb, and pc
|
||||
* \param pa the first point
|
||||
* \param pb the second point
|
||||
* \param pc the third point
|
||||
* \return the radius of the circumscribed circle
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline double
|
||||
getCircumcircleRadius (const PointT &pa, const PointT &pb, const PointT &pc);
|
||||
|
||||
/** \brief Get the minimum and maximum values on a point histogram
|
||||
* \param histogram the point representing a multi-dimensional histogram
|
||||
* \param len the length of the histogram
|
||||
* \param min_p the resultant minimum
|
||||
* \param max_p the resultant maximum
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
getMinMax (const PointT &histogram, int len, float &min_p, float &max_p);
|
||||
|
||||
/** \brief Calculate the area of a polygon given a point cloud that defines the polygon
|
||||
* \param polygon point cloud that contains those vertices that comprises the polygon. Vertices are stored in counterclockwise.
|
||||
* \return the polygon area
|
||||
* \ingroup common
|
||||
*/
|
||||
template<typename PointT> inline float
|
||||
calculatePolygonArea (const pcl::PointCloud<PointT> &polygon);
|
||||
|
||||
/** \brief Get the minimum and maximum values on a point histogram
|
||||
* \param cloud the cloud containing multi-dimensional histograms
|
||||
* \param idx point index representing the histogram that we need to compute min/max for
|
||||
* \param field_name the field name containing the multi-dimensional histogram
|
||||
* \param min_p the resultant minimum
|
||||
* \param max_p the resultant maximum
|
||||
* \ingroup common
|
||||
*/
|
||||
PCL_EXPORTS void
|
||||
getMinMax (const pcl::PCLPointCloud2 &cloud, int idx, const std::string &field_name,
|
||||
float &min_p, float &max_p);
|
||||
|
||||
/** \brief Compute both the mean and the standard deviation of an array of values
|
||||
* \param values the array of values
|
||||
* \param mean the resultant mean of the distribution
|
||||
* \param stddev the resultant standard deviation of the distribution
|
||||
* \ingroup common
|
||||
*/
|
||||
PCL_EXPORTS void
|
||||
getMeanStdDev (const std::vector<float> &values, double &mean, double &stddev);
|
||||
|
||||
}
|
||||
/*@}*/
|
||||
#include <pcl/common/impl/common.hpp>
|
||||
43
deps_install/include/pcl-1.10/pcl/common/common_headers.h
Executable file
43
deps_install/include/pcl-1.10/pcl/common/common_headers.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/common/common.h>
|
||||
#include <pcl/common/norms.h>
|
||||
#include <pcl/common/angles.h>
|
||||
#include <pcl/common/time.h>
|
||||
#include <pcl/common/file_io.h>
|
||||
#include <pcl/common/eigen.h>
|
||||
80
deps_install/include/pcl-1.10/pcl/common/concatenate.h
Executable file
80
deps_install/include/pcl-1.10/pcl/common/concatenate.h
Executable file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2011, Willow Garage, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/conversions.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Helper functor structure for concatenate.
|
||||
* \ingroup common
|
||||
*/
|
||||
template<typename PointInT, typename PointOutT>
|
||||
struct NdConcatenateFunctor
|
||||
{
|
||||
using PodIn = typename traits::POD<PointInT>::type;
|
||||
using PodOut = typename traits::POD<PointOutT>::type;
|
||||
|
||||
NdConcatenateFunctor (const PointInT &p1, PointOutT &p2)
|
||||
: p1_ (reinterpret_cast<const PodIn&> (p1))
|
||||
, p2_ (reinterpret_cast<PodOut&> (p2)) { }
|
||||
|
||||
template<typename Key> inline void
|
||||
operator () ()
|
||||
{
|
||||
// This sucks without Fusion :(
|
||||
//boost::fusion::at_key<Key> (p2_) = boost::fusion::at_key<Key> (p1_);
|
||||
using InT = typename pcl::traits::datatype<PointInT, Key>::type;
|
||||
using OutT = typename pcl::traits::datatype<PointOutT, Key>::type;
|
||||
// Note: don't currently support different types for the same field (e.g. converting double to float)
|
||||
BOOST_MPL_ASSERT_MSG ((std::is_same<InT, OutT>::value),
|
||||
POINT_IN_AND_POINT_OUT_HAVE_DIFFERENT_TYPES_FOR_FIELD,
|
||||
(Key, PointInT&, InT, PointOutT&, OutT));
|
||||
memcpy (reinterpret_cast<std::uint8_t*>(&p2_) + pcl::traits::offset<PointOutT, Key>::value,
|
||||
reinterpret_cast<const std::uint8_t*>(&p1_) + pcl::traits::offset<PointInT, Key>::value,
|
||||
sizeof (InT));
|
||||
}
|
||||
|
||||
private:
|
||||
const PodIn &p1_;
|
||||
PodOut &p2_;
|
||||
};
|
||||
}
|
||||
58
deps_install/include/pcl-1.10/pcl/common/copy_point.h
Executable file
58
deps_install/include/pcl-1.10/pcl/common/copy_point.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2014-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
|
||||
/** \brief Copy the fields of a source point into a target point.
|
||||
*
|
||||
* If the source and the target point types are the same, then a complete
|
||||
* copy is made. Otherwise only those fields that the two point types share
|
||||
* in common are copied.
|
||||
*
|
||||
* \param[in] point_in the source point
|
||||
* \param[out] point_out the target point
|
||||
*
|
||||
* \ingroup common */
|
||||
template <typename PointInT, typename PointOutT> void
|
||||
copyPoint (const PointInT& point_in, PointOutT& point_out);
|
||||
|
||||
}
|
||||
|
||||
#include <pcl/common/impl/copy_point.hpp>
|
||||
204
deps_install/include/pcl-1.10/pcl/common/distances.h
Executable file
204
deps_install/include/pcl-1.10/pcl/common/distances.h
Executable file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <pcl/common/common.h>
|
||||
|
||||
/**
|
||||
* \file pcl/common/distances.h
|
||||
* Define standard C methods to do distance calculations
|
||||
* \ingroup common
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Get the shortest 3D segment between two 3D lines
|
||||
* \param line_a the coefficients of the first line (point, direction)
|
||||
* \param line_b the coefficients of the second line (point, direction)
|
||||
* \param pt1_seg the first point on the line segment
|
||||
* \param pt2_seg the second point on the line segment
|
||||
* \ingroup common
|
||||
*/
|
||||
PCL_EXPORTS void
|
||||
lineToLineSegment (const Eigen::VectorXf &line_a, const Eigen::VectorXf &line_b,
|
||||
Eigen::Vector4f &pt1_seg, Eigen::Vector4f &pt2_seg);
|
||||
|
||||
/** \brief Get the square distance from a point to a line (represented by a point and a direction)
|
||||
* \param pt a point
|
||||
* \param line_pt a point on the line (make sure that line_pt[3] = 0 as there are no internal checks!)
|
||||
* \param line_dir the line direction
|
||||
* \ingroup common
|
||||
*/
|
||||
double inline
|
||||
sqrPointToLineDistance (const Eigen::Vector4f &pt, const Eigen::Vector4f &line_pt, const Eigen::Vector4f &line_dir)
|
||||
{
|
||||
// Calculate the distance from the point to the line
|
||||
// D = ||(P2-P1) x (P1-P0)|| / ||P2-P1|| = norm (cross (p2-p1, p1-p0)) / norm(p2-p1)
|
||||
return (line_dir.cross3 (line_pt - pt)).squaredNorm () / line_dir.squaredNorm ();
|
||||
}
|
||||
|
||||
/** \brief Get the square distance from a point to a line (represented by a point and a direction)
|
||||
* \note This one is useful if one has to compute many distances to a fixed line, so the vector length can be pre-computed
|
||||
* \param pt a point
|
||||
* \param line_pt a point on the line (make sure that line_pt[3] = 0 as there are no internal checks!)
|
||||
* \param line_dir the line direction
|
||||
* \param sqr_length the squared norm of the line direction
|
||||
* \ingroup common
|
||||
*/
|
||||
double inline
|
||||
sqrPointToLineDistance (const Eigen::Vector4f &pt, const Eigen::Vector4f &line_pt, const Eigen::Vector4f &line_dir, const double sqr_length)
|
||||
{
|
||||
// Calculate the distance from the point to the line
|
||||
// D = ||(P2-P1) x (P1-P0)|| / ||P2-P1|| = norm (cross (p2-p1, p1-p0)) / norm(p2-p1)
|
||||
return (line_dir.cross3 (line_pt - pt)).squaredNorm () / sqr_length;
|
||||
}
|
||||
|
||||
/** \brief Obtain the maximum segment in a given set of points, and return the minimum and maximum points.
|
||||
* \param[in] cloud the point cloud dataset
|
||||
* \param[out] pmin the coordinates of the "minimum" point in \a cloud (one end of the segment)
|
||||
* \param[out] pmax the coordinates of the "maximum" point in \a cloud (the other end of the segment)
|
||||
* \return the length of segment length
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> double inline
|
||||
getMaxSegment (const pcl::PointCloud<PointT> &cloud,
|
||||
PointT &pmin, PointT &pmax)
|
||||
{
|
||||
double max_dist = std::numeric_limits<double>::min ();
|
||||
const auto token = std::numeric_limits<std::size_t>::max();
|
||||
std::size_t i_min = token, i_max = token;
|
||||
|
||||
for (std::size_t i = 0; i < cloud.points.size (); ++i)
|
||||
{
|
||||
for (std::size_t j = i; j < cloud.points.size (); ++j)
|
||||
{
|
||||
// Compute the distance
|
||||
double dist = (cloud.points[i].getVector4fMap () -
|
||||
cloud.points[j].getVector4fMap ()).squaredNorm ();
|
||||
if (dist <= max_dist)
|
||||
continue;
|
||||
|
||||
max_dist = dist;
|
||||
i_min = i;
|
||||
i_max = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (i_min == token || i_max == token)
|
||||
return (max_dist = std::numeric_limits<double>::min ());
|
||||
|
||||
pmin = cloud.points[i_min];
|
||||
pmax = cloud.points[i_max];
|
||||
return (std::sqrt (max_dist));
|
||||
}
|
||||
|
||||
/** \brief Obtain the maximum segment in a given set of points, and return the minimum and maximum points.
|
||||
* \param[in] cloud the point cloud dataset
|
||||
* \param[in] indices a set of point indices to use from \a cloud
|
||||
* \param[out] pmin the coordinates of the "minimum" point in \a cloud (one end of the segment)
|
||||
* \param[out] pmax the coordinates of the "maximum" point in \a cloud (the other end of the segment)
|
||||
* \return the length of segment length
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename PointT> double inline
|
||||
getMaxSegment (const pcl::PointCloud<PointT> &cloud, const std::vector<int> &indices,
|
||||
PointT &pmin, PointT &pmax)
|
||||
{
|
||||
double max_dist = std::numeric_limits<double>::min ();
|
||||
const auto token = std::numeric_limits<std::size_t>::max();
|
||||
std::size_t i_min = token, i_max = token;
|
||||
|
||||
for (std::size_t i = 0; i < indices.size (); ++i)
|
||||
{
|
||||
for (std::size_t j = i; j < indices.size (); ++j)
|
||||
{
|
||||
// Compute the distance
|
||||
double dist = (cloud.points[indices[i]].getVector4fMap () -
|
||||
cloud.points[indices[j]].getVector4fMap ()).squaredNorm ();
|
||||
if (dist <= max_dist)
|
||||
continue;
|
||||
|
||||
max_dist = dist;
|
||||
i_min = i;
|
||||
i_max = j;
|
||||
}
|
||||
}
|
||||
|
||||
if (i_min == token || i_max == token)
|
||||
return (max_dist = std::numeric_limits<double>::min ());
|
||||
|
||||
pmin = cloud.points[indices[i_min]];
|
||||
pmax = cloud.points[indices[i_max]];
|
||||
return (std::sqrt (max_dist));
|
||||
}
|
||||
|
||||
/** \brief Calculate the squared euclidean distance between the two given points.
|
||||
* \param[in] p1 the first point
|
||||
* \param[in] p2 the second point
|
||||
*/
|
||||
template<typename PointType1, typename PointType2> inline float
|
||||
squaredEuclideanDistance (const PointType1& p1, const PointType2& p2)
|
||||
{
|
||||
float diff_x = p2.x - p1.x, diff_y = p2.y - p1.y, diff_z = p2.z - p1.z;
|
||||
return (diff_x*diff_x + diff_y*diff_y + diff_z*diff_z);
|
||||
}
|
||||
|
||||
/** \brief Calculate the squared euclidean distance between the two given points.
|
||||
* \param[in] p1 the first point
|
||||
* \param[in] p2 the second point
|
||||
*/
|
||||
template<> inline float
|
||||
squaredEuclideanDistance (const PointXY& p1, const PointXY& p2)
|
||||
{
|
||||
float diff_x = p2.x - p1.x, diff_y = p2.y - p1.y;
|
||||
return (diff_x*diff_x + diff_y*diff_y);
|
||||
}
|
||||
|
||||
/** \brief Calculate the euclidean distance between the two given points.
|
||||
* \param[in] p1 the first point
|
||||
* \param[in] p2 the second point
|
||||
*/
|
||||
template<typename PointType1, typename PointType2> inline float
|
||||
euclideanDistance (const PointType1& p1, const PointType2& p2)
|
||||
{
|
||||
return (std::sqrt (squaredEuclideanDistance (p1, p2)));
|
||||
}
|
||||
}
|
||||
720
deps_install/include/pcl-1.10/pcl/common/eigen.h
Executable file
720
deps_install/include/pcl-1.10/pcl/common/eigen.h
Executable file
@@ -0,0 +1,720 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2012, Willow Garage, Inc.
|
||||
* Copyright (C) 2010 Gael Guennebaud <gael.guennebaud@inria.fr>
|
||||
* Copyright (C) 2009 Hauke Heibel <hauke.heibel@gmail.com>
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC system_header
|
||||
#elif defined __SUNPRO_CC
|
||||
# pragma disable_warn
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <pcl/ModelCoefficients.h>
|
||||
|
||||
#include <Eigen/StdVector>
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Eigenvalues>
|
||||
#include <Eigen/Geometry>
|
||||
#include <Eigen/SVD>
|
||||
#include <Eigen/LU>
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Eigenvalues>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Compute the roots of a quadratic polynom x^2 + b*x + c = 0
|
||||
* \param[in] b linear parameter
|
||||
* \param[in] c constant parameter
|
||||
* \param[out] roots solutions of x^2 + b*x + c = 0
|
||||
*/
|
||||
template <typename Scalar, typename Roots> void
|
||||
computeRoots2 (const Scalar &b, const Scalar &c, Roots &roots);
|
||||
|
||||
/** \brief computes the roots of the characteristic polynomial of the input matrix m, which are the eigenvalues
|
||||
* \param[in] m input matrix
|
||||
* \param[out] roots roots of the characteristic polynomial of the input matrix m, which are the eigenvalues
|
||||
*/
|
||||
template <typename Matrix, typename Roots> void
|
||||
computeRoots (const Matrix &m, Roots &roots);
|
||||
|
||||
/** \brief determine the smallest eigenvalue and its corresponding eigenvector
|
||||
* \param[in] mat input matrix that needs to be symmetric and positive semi definite
|
||||
* \param[out] eigenvalue the smallest eigenvalue of the input matrix
|
||||
* \param[out] eigenvector the corresponding eigenvector to the smallest eigenvalue of the input matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
eigen22 (const Matrix &mat, typename Matrix::Scalar &eigenvalue, Vector &eigenvector);
|
||||
|
||||
/** \brief determine the smallest eigenvalue and its corresponding eigenvector
|
||||
* \param[in] mat input matrix that needs to be symmetric and positive semi definite
|
||||
* \param[out] eigenvectors the corresponding eigenvector to the smallest eigenvalue of the input matrix
|
||||
* \param[out] eigenvalues the smallest eigenvalue of the input matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
eigen22 (const Matrix &mat, Matrix &eigenvectors, Vector &eigenvalues);
|
||||
|
||||
/** \brief determines the corresponding eigenvector to the given eigenvalue of the symmetric positive semi definite input matrix
|
||||
* \param[in] mat symmetric positive semi definite input matrix
|
||||
* \param[in] eigenvalue the eigenvalue which corresponding eigenvector is to be computed
|
||||
* \param[out] eigenvector the corresponding eigenvector for the input eigenvalue
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
computeCorrespondingEigenVector (const Matrix &mat, const typename Matrix::Scalar &eigenvalue, Vector &eigenvector);
|
||||
|
||||
/** \brief determines the eigenvector and eigenvalue of the smallest eigenvalue of the symmetric positive semi definite input matrix
|
||||
* \param[in] mat symmetric positive semi definite input matrix
|
||||
* \param[out] eigenvalue smallest eigenvalue of the input matrix
|
||||
* \param[out] eigenvector the corresponding eigenvector for the input eigenvalue
|
||||
* \note if the smallest eigenvalue is not unique, this function may return any eigenvector that is consistent to the eigenvalue.
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
eigen33 (const Matrix &mat, typename Matrix::Scalar &eigenvalue, Vector &eigenvector);
|
||||
|
||||
/** \brief determines the eigenvalues of the symmetric positive semi definite input matrix
|
||||
* \param[in] mat symmetric positive semi definite input matrix
|
||||
* \param[out] evals resulting eigenvalues in ascending order
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
eigen33 (const Matrix &mat, Vector &evals);
|
||||
|
||||
/** \brief determines the eigenvalues and corresponding eigenvectors of the symmetric positive semi definite input matrix
|
||||
* \param[in] mat symmetric positive semi definite input matrix
|
||||
* \param[out] evecs corresponding eigenvectors in correct order according to eigenvalues
|
||||
* \param[out] evals resulting eigenvalues in ascending order
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix, typename Vector> void
|
||||
eigen33 (const Matrix &mat, Matrix &evecs, Vector &evals);
|
||||
|
||||
/** \brief Calculate the inverse of a 2x2 matrix
|
||||
* \param[in] matrix matrix to be inverted
|
||||
* \param[out] inverse the resultant inverted matrix
|
||||
* \note only the upper triangular part is taken into account => non symmetric matrices will give wrong results
|
||||
* \return determinant of the original matrix => if 0 no inverse exists => result is invalid
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix> typename Matrix::Scalar
|
||||
invert2x2 (const Matrix &matrix, Matrix &inverse);
|
||||
|
||||
/** \brief Calculate the inverse of a 3x3 symmetric matrix.
|
||||
* \param[in] matrix matrix to be inverted
|
||||
* \param[out] inverse the resultant inverted matrix
|
||||
* \note only the upper triangular part is taken into account => non symmetric matrices will give wrong results
|
||||
* \return determinant of the original matrix => if 0 no inverse exists => result is invalid
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix> typename Matrix::Scalar
|
||||
invert3x3SymMatrix (const Matrix &matrix, Matrix &inverse);
|
||||
|
||||
/** \brief Calculate the inverse of a general 3x3 matrix.
|
||||
* \param[in] matrix matrix to be inverted
|
||||
* \param[out] inverse the resultant inverted matrix
|
||||
* \return determinant of the original matrix => if 0 no inverse exists => result is invalid
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix> typename Matrix::Scalar
|
||||
invert3x3Matrix (const Matrix &matrix, Matrix &inverse);
|
||||
|
||||
/** \brief Calculate the determinant of a 3x3 matrix.
|
||||
* \param[in] matrix matrix
|
||||
* \return determinant of the matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Matrix> typename Matrix::Scalar
|
||||
determinant3x3Matrix (const Matrix &matrix);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a z_axis into (0,0,1) and \a y_direction into a vector
|
||||
* with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] z_axis the z-axis
|
||||
* \param[in] y_direction the y direction
|
||||
* \param[out] transformation the resultant 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline void
|
||||
getTransFromUnitVectorsZY (const Eigen::Vector3f& z_axis,
|
||||
const Eigen::Vector3f& y_direction,
|
||||
Eigen::Affine3f& transformation);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a z_axis into (0,0,1) and \a y_direction into a vector
|
||||
* with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] z_axis the z-axis
|
||||
* \param[in] y_direction the y direction
|
||||
* \return the resultant 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline Eigen::Affine3f
|
||||
getTransFromUnitVectorsZY (const Eigen::Vector3f& z_axis,
|
||||
const Eigen::Vector3f& y_direction);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a x_axis into (1,0,0) and \a y_direction into a vector
|
||||
* with z=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] x_axis the x-axis
|
||||
* \param[in] y_direction the y direction
|
||||
* \param[out] transformation the resultant 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline void
|
||||
getTransFromUnitVectorsXY (const Eigen::Vector3f& x_axis,
|
||||
const Eigen::Vector3f& y_direction,
|
||||
Eigen::Affine3f& transformation);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a x_axis into (1,0,0) and \a y_direction into a vector
|
||||
* with z=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] x_axis the x-axis
|
||||
* \param[in] y_direction the y direction
|
||||
* \return the resulting 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline Eigen::Affine3f
|
||||
getTransFromUnitVectorsXY (const Eigen::Vector3f& x_axis,
|
||||
const Eigen::Vector3f& y_direction);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a z_axis into (0,0,1) and \a y_direction into a vector
|
||||
* with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] y_direction the y direction
|
||||
* \param[in] z_axis the z-axis
|
||||
* \param[out] transformation the resultant 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline void
|
||||
getTransformationFromTwoUnitVectors (const Eigen::Vector3f& y_direction,
|
||||
const Eigen::Vector3f& z_axis,
|
||||
Eigen::Affine3f& transformation);
|
||||
|
||||
/** \brief Get the unique 3D rotation that will rotate \a z_axis into (0,0,1) and \a y_direction into a vector
|
||||
* with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] y_direction the y direction
|
||||
* \param[in] z_axis the z-axis
|
||||
* \return transformation the resultant 3D rotation
|
||||
* \ingroup common
|
||||
*/
|
||||
inline Eigen::Affine3f
|
||||
getTransformationFromTwoUnitVectors (const Eigen::Vector3f& y_direction,
|
||||
const Eigen::Vector3f& z_axis);
|
||||
|
||||
/** \brief Get the transformation that will translate \a origin to (0,0,0) and rotate \a z_axis into (0,0,1)
|
||||
* and \a y_direction into a vector with x=0 (or into (0,1,0) should \a y_direction be orthogonal to \a z_axis)
|
||||
* \param[in] y_direction the y direction
|
||||
* \param[in] z_axis the z-axis
|
||||
* \param[in] origin the origin
|
||||
* \param[in] transformation the resultant transformation matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
inline void
|
||||
getTransformationFromTwoUnitVectorsAndOrigin (const Eigen::Vector3f& y_direction,
|
||||
const Eigen::Vector3f& z_axis,
|
||||
const Eigen::Vector3f& origin,
|
||||
Eigen::Affine3f& transformation);
|
||||
|
||||
/** \brief Extract the Euler angles (XYZ-convention) from the given transformation
|
||||
* \param[in] t the input transformation matrix
|
||||
* \param[in] roll the resulting roll angle
|
||||
* \param[in] pitch the resulting pitch angle
|
||||
* \param[in] yaw the resulting yaw angle
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Scalar> void
|
||||
getEulerAngles (const Eigen::Transform<Scalar, 3, Eigen::Affine> &t, Scalar &roll, Scalar &pitch, Scalar &yaw);
|
||||
|
||||
inline void
|
||||
getEulerAngles (const Eigen::Affine3f &t, float &roll, float &pitch, float &yaw)
|
||||
{
|
||||
getEulerAngles<float> (t, roll, pitch, yaw);
|
||||
}
|
||||
|
||||
inline void
|
||||
getEulerAngles (const Eigen::Affine3d &t, double &roll, double &pitch, double &yaw)
|
||||
{
|
||||
getEulerAngles<double> (t, roll, pitch, yaw);
|
||||
}
|
||||
|
||||
/** Extract x,y,z and the Euler angles (XYZ-convention) from the given transformation
|
||||
* \param[in] t the input transformation matrix
|
||||
* \param[out] x the resulting x translation
|
||||
* \param[out] y the resulting y translation
|
||||
* \param[out] z the resulting z translation
|
||||
* \param[out] roll the resulting roll angle
|
||||
* \param[out] pitch the resulting pitch angle
|
||||
* \param[out] yaw the resulting yaw angle
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Scalar> void
|
||||
getTranslationAndEulerAngles (const Eigen::Transform<Scalar, 3, Eigen::Affine> &t,
|
||||
Scalar &x, Scalar &y, Scalar &z,
|
||||
Scalar &roll, Scalar &pitch, Scalar &yaw);
|
||||
|
||||
inline void
|
||||
getTranslationAndEulerAngles (const Eigen::Affine3f &t,
|
||||
float &x, float &y, float &z,
|
||||
float &roll, float &pitch, float &yaw)
|
||||
{
|
||||
getTranslationAndEulerAngles<float> (t, x, y, z, roll, pitch, yaw);
|
||||
}
|
||||
|
||||
inline void
|
||||
getTranslationAndEulerAngles (const Eigen::Affine3d &t,
|
||||
double &x, double &y, double &z,
|
||||
double &roll, double &pitch, double &yaw)
|
||||
{
|
||||
getTranslationAndEulerAngles<double> (t, x, y, z, roll, pitch, yaw);
|
||||
}
|
||||
|
||||
/** \brief Create a transformation from the given translation and Euler angles (XYZ-convention)
|
||||
* \param[in] x the input x translation
|
||||
* \param[in] y the input y translation
|
||||
* \param[in] z the input z translation
|
||||
* \param[in] roll the input roll angle
|
||||
* \param[in] pitch the input pitch angle
|
||||
* \param[in] yaw the input yaw angle
|
||||
* \param[out] t the resulting transformation matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Scalar> void
|
||||
getTransformation (Scalar x, Scalar y, Scalar z, Scalar roll, Scalar pitch, Scalar yaw,
|
||||
Eigen::Transform<Scalar, 3, Eigen::Affine> &t);
|
||||
|
||||
inline void
|
||||
getTransformation (float x, float y, float z, float roll, float pitch, float yaw,
|
||||
Eigen::Affine3f &t)
|
||||
{
|
||||
return (getTransformation<float> (x, y, z, roll, pitch, yaw, t));
|
||||
}
|
||||
|
||||
inline void
|
||||
getTransformation (double x, double y, double z, double roll, double pitch, double yaw,
|
||||
Eigen::Affine3d &t)
|
||||
{
|
||||
return (getTransformation<double> (x, y, z, roll, pitch, yaw, t));
|
||||
}
|
||||
|
||||
/** \brief Create a transformation from the given translation and Euler angles (XYZ-convention)
|
||||
* \param[in] x the input x translation
|
||||
* \param[in] y the input y translation
|
||||
* \param[in] z the input z translation
|
||||
* \param[in] roll the input roll angle
|
||||
* \param[in] pitch the input pitch angle
|
||||
* \param[in] yaw the input yaw angle
|
||||
* \return the resulting transformation matrix
|
||||
* \ingroup common
|
||||
*/
|
||||
inline Eigen::Affine3f
|
||||
getTransformation (float x, float y, float z, float roll, float pitch, float yaw)
|
||||
{
|
||||
Eigen::Affine3f t;
|
||||
getTransformation<float> (x, y, z, roll, pitch, yaw, t);
|
||||
return (t);
|
||||
}
|
||||
|
||||
/** \brief Write a matrix to an output stream
|
||||
* \param[in] matrix the matrix to output
|
||||
* \param[out] file the output stream
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Derived> void
|
||||
saveBinary (const Eigen::MatrixBase<Derived>& matrix, std::ostream& file);
|
||||
|
||||
/** \brief Read a matrix from an input stream
|
||||
* \param[out] matrix the resulting matrix, read from the input stream
|
||||
* \param[in,out] file the input stream
|
||||
* \ingroup common
|
||||
*/
|
||||
template <typename Derived> void
|
||||
loadBinary (Eigen::MatrixBase<Derived> const& matrix, std::istream& file);
|
||||
|
||||
// PCL_EIGEN_SIZE_MIN_PREFER_DYNAMIC gives the min between compile-time sizes. 0 has absolute priority, followed by 1,
|
||||
// followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over
|
||||
// finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3.
|
||||
#define PCL_EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) ((int (a) == 0 || int (b) == 0) ? 0 \
|
||||
: (int (a) == 1 || int (b) == 1) ? 1 \
|
||||
: (int (a) == Eigen::Dynamic || int (b) == Eigen::Dynamic) ? Eigen::Dynamic \
|
||||
: (int (a) <= int (b)) ? int (a) : int (b))
|
||||
|
||||
/** \brief Returns the transformation between two point sets.
|
||||
* The algorithm is based on:
|
||||
* "Least-squares estimation of transformation parameters between two point patterns",
|
||||
* Shinji Umeyama, PAMI 1991, DOI: 10.1109/34.88573
|
||||
*
|
||||
* It estimates parameters \f$ c, \mathbf{R}, \f$ and \f$ \mathbf{t} \f$ such that
|
||||
* \f{align*}
|
||||
* \frac{1}{n} \sum_{i=1}^n \vert\vert y_i - (c\mathbf{R}x_i + \mathbf{t}) \vert\vert_2^2
|
||||
* \f}
|
||||
* is minimized.
|
||||
*
|
||||
* The algorithm is based on the analysis of the covariance matrix
|
||||
* \f$ \Sigma_{\mathbf{x}\mathbf{y}} \in \mathbb{R}^{d \times d} \f$
|
||||
* of the input point sets \f$ \mathbf{x} \f$ and \f$ \mathbf{y} \f$ where
|
||||
* \f$d\f$ is corresponding to the dimension (which is typically small).
|
||||
* The analysis is involving the SVD having a complexity of \f$O(d^3)\f$
|
||||
* though the actual computational effort lies in the covariance
|
||||
* matrix computation which has an asymptotic lower bound of \f$O(dm)\f$ when
|
||||
* the input point sets have dimension \f$d \times m\f$.
|
||||
*
|
||||
* \param[in] src Source points \f$ \mathbf{x} = \left( x_1, \hdots, x_n \right) \f$
|
||||
* \param[in] dst Destination points \f$ \mathbf{y} = \left( y_1, \hdots, y_n \right) \f$.
|
||||
* \param[in] with_scaling Sets \f$ c=1 \f$ when <code>false</code> is passed. (default: false)
|
||||
* \return The homogeneous transformation
|
||||
* \f{align*}
|
||||
* T = \begin{bmatrix} c\mathbf{R} & \mathbf{t} \\ \mathbf{0} & 1 \end{bmatrix}
|
||||
* \f}
|
||||
* minimizing the resudiual above. This transformation is always returned as an
|
||||
* Eigen::Matrix.
|
||||
*/
|
||||
template <typename Derived, typename OtherDerived>
|
||||
typename Eigen::internal::umeyama_transform_matrix_type<Derived, OtherDerived>::type
|
||||
umeyama (const Eigen::MatrixBase<Derived>& src, const Eigen::MatrixBase<OtherDerived>& dst, bool with_scaling = false);
|
||||
|
||||
/** \brief Transform a point using an affine matrix
|
||||
* \param[in] point_in the vector to be transformed
|
||||
* \param[out] point_out the transformed vector
|
||||
* \param[in] transformation the transformation matrix
|
||||
*
|
||||
* \note Can be used with \c point_in = \c point_out
|
||||
*/
|
||||
template<typename Scalar> inline void
|
||||
transformPoint (const Eigen::Matrix<Scalar, 3, 1> &point_in,
|
||||
Eigen::Matrix<Scalar, 3, 1> &point_out,
|
||||
const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
Eigen::Matrix<Scalar, 4, 1> point;
|
||||
point << point_in, 1.0;
|
||||
point_out = (transformation * point).template head<3> ();
|
||||
}
|
||||
|
||||
inline void
|
||||
transformPoint (const Eigen::Vector3f &point_in,
|
||||
Eigen::Vector3f &point_out,
|
||||
const Eigen::Affine3f &transformation)
|
||||
{
|
||||
transformPoint<float> (point_in, point_out, transformation);
|
||||
}
|
||||
|
||||
inline void
|
||||
transformPoint (const Eigen::Vector3d &point_in,
|
||||
Eigen::Vector3d &point_out,
|
||||
const Eigen::Affine3d &transformation)
|
||||
{
|
||||
transformPoint<double> (point_in, point_out, transformation);
|
||||
}
|
||||
|
||||
/** \brief Transform a vector using an affine matrix
|
||||
* \param[in] vector_in the vector to be transformed
|
||||
* \param[out] vector_out the transformed vector
|
||||
* \param[in] transformation the transformation matrix
|
||||
*
|
||||
* \note Can be used with \c vector_in = \c vector_out
|
||||
*/
|
||||
template <typename Scalar> inline void
|
||||
transformVector (const Eigen::Matrix<Scalar, 3, 1> &vector_in,
|
||||
Eigen::Matrix<Scalar, 3, 1> &vector_out,
|
||||
const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
vector_out = transformation.linear () * vector_in;
|
||||
}
|
||||
|
||||
inline void
|
||||
transformVector (const Eigen::Vector3f &vector_in,
|
||||
Eigen::Vector3f &vector_out,
|
||||
const Eigen::Affine3f &transformation)
|
||||
{
|
||||
transformVector<float> (vector_in, vector_out, transformation);
|
||||
}
|
||||
|
||||
inline void
|
||||
transformVector (const Eigen::Vector3d &vector_in,
|
||||
Eigen::Vector3d &vector_out,
|
||||
const Eigen::Affine3d &transformation)
|
||||
{
|
||||
transformVector<double> (vector_in, vector_out, transformation);
|
||||
}
|
||||
|
||||
/** \brief Transform a line using an affine matrix
|
||||
* \param[in] line_in the line to be transformed
|
||||
* \param[out] line_out the transformed line
|
||||
* \param[in] transformation the transformation matrix
|
||||
*
|
||||
* Lines must be filled in this form:\n
|
||||
* line[0-2] = Origin coordinates of the vector\n
|
||||
* line[3-5] = Direction vector
|
||||
*
|
||||
* \note Can be used with \c line_in = \c line_out
|
||||
*/
|
||||
template <typename Scalar> bool
|
||||
transformLine (const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_in,
|
||||
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_out,
|
||||
const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
|
||||
|
||||
inline bool
|
||||
transformLine (const Eigen::VectorXf &line_in,
|
||||
Eigen::VectorXf &line_out,
|
||||
const Eigen::Affine3f &transformation)
|
||||
{
|
||||
return (transformLine<float> (line_in, line_out, transformation));
|
||||
}
|
||||
|
||||
inline bool
|
||||
transformLine (const Eigen::VectorXd &line_in,
|
||||
Eigen::VectorXd &line_out,
|
||||
const Eigen::Affine3d &transformation)
|
||||
{
|
||||
return (transformLine<double> (line_in, line_out, transformation));
|
||||
}
|
||||
|
||||
/** \brief Transform plane vectors using an affine matrix
|
||||
* \param[in] plane_in the plane coefficients to be transformed
|
||||
* \param[out] plane_out the transformed plane coefficients to fill
|
||||
* \param[in] transformation the transformation matrix
|
||||
*
|
||||
* The plane vectors are filled in the form ax+by+cz+d=0
|
||||
* Can be used with non Hessian form planes coefficients
|
||||
* Can be used with \c plane_in = \c plane_out
|
||||
*/
|
||||
template <typename Scalar> void
|
||||
transformPlane (const Eigen::Matrix<Scalar, 4, 1> &plane_in,
|
||||
Eigen::Matrix<Scalar, 4, 1> &plane_out,
|
||||
const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
|
||||
|
||||
inline void
|
||||
transformPlane (const Eigen::Matrix<double, 4, 1> &plane_in,
|
||||
Eigen::Matrix<double, 4, 1> &plane_out,
|
||||
const Eigen::Transform<double, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
transformPlane<double> (plane_in, plane_out, transformation);
|
||||
}
|
||||
|
||||
inline void
|
||||
transformPlane (const Eigen::Matrix<float, 4, 1> &plane_in,
|
||||
Eigen::Matrix<float, 4, 1> &plane_out,
|
||||
const Eigen::Transform<float, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
transformPlane<float> (plane_in, plane_out, transformation);
|
||||
}
|
||||
|
||||
/** \brief Transform plane vectors using an affine matrix
|
||||
* \param[in] plane_in the plane coefficients to be transformed
|
||||
* \param[out] plane_out the transformed plane coefficients to fill
|
||||
* \param[in] transformation the transformation matrix
|
||||
*
|
||||
* The plane vectors are filled in the form ax+by+cz+d=0
|
||||
* Can be used with non Hessian form planes coefficients
|
||||
* Can be used with \c plane_in = \c plane_out
|
||||
* \warning ModelCoefficients stores floats only !
|
||||
*/
|
||||
template<typename Scalar> void
|
||||
transformPlane (const pcl::ModelCoefficients::Ptr plane_in,
|
||||
pcl::ModelCoefficients::Ptr plane_out,
|
||||
const Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
|
||||
|
||||
inline void
|
||||
transformPlane (const pcl::ModelCoefficients::Ptr plane_in,
|
||||
pcl::ModelCoefficients::Ptr plane_out,
|
||||
const Eigen::Transform<double, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
transformPlane<double> (plane_in, plane_out, transformation);
|
||||
}
|
||||
|
||||
inline void
|
||||
transformPlane (const pcl::ModelCoefficients::Ptr plane_in,
|
||||
pcl::ModelCoefficients::Ptr plane_out,
|
||||
const Eigen::Transform<float, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
transformPlane<float> (plane_in, plane_out, transformation);
|
||||
}
|
||||
|
||||
/** \brief Check coordinate system integrity
|
||||
* \param[in] line_x the first axis
|
||||
* \param[in] line_y the second axis
|
||||
* \param[in] norm_limit the limit to ignore norm rounding errors
|
||||
* \param[in] dot_limit the limit to ignore dot product rounding errors
|
||||
* \return True if the coordinate system is consistent, false otherwise.
|
||||
*
|
||||
* Lines must be filled in this form:\n
|
||||
* line[0-2] = Origin coordinates of the vector\n
|
||||
* line[3-5] = Direction vector
|
||||
*
|
||||
* Can be used like this :\n
|
||||
* line_x = X axis and line_y = Y axis\n
|
||||
* line_x = Z axis and line_y = X axis\n
|
||||
* line_x = Y axis and line_y = Z axis\n
|
||||
* Because X^Y = Z, Z^X = Y and Y^Z = X.
|
||||
* Do NOT invert line order !
|
||||
*
|
||||
* Determine whether a coordinate system is consistent or not by checking :\n
|
||||
* Line origins: They must be the same for the 2 lines\n
|
||||
* Norm: The 2 lines must be normalized\n
|
||||
* Dot products: Must be 0 or perpendicular vectors
|
||||
*/
|
||||
template<typename Scalar> bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_x,
|
||||
const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> &line_y,
|
||||
const Scalar norm_limit = 1e-3,
|
||||
const Scalar dot_limit = 1e-3);
|
||||
|
||||
inline bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<double, Eigen::Dynamic, 1> &line_x,
|
||||
const Eigen::Matrix<double, Eigen::Dynamic, 1> &line_y,
|
||||
const double norm_limit = 1e-3,
|
||||
const double dot_limit = 1e-3)
|
||||
{
|
||||
return (checkCoordinateSystem<double> (line_x, line_y, norm_limit, dot_limit));
|
||||
}
|
||||
|
||||
inline bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<float, Eigen::Dynamic, 1> &line_x,
|
||||
const Eigen::Matrix<float, Eigen::Dynamic, 1> &line_y,
|
||||
const float norm_limit = 1e-3,
|
||||
const float dot_limit = 1e-3)
|
||||
{
|
||||
return (checkCoordinateSystem<float> (line_x, line_y, norm_limit, dot_limit));
|
||||
}
|
||||
|
||||
/** \brief Check coordinate system integrity
|
||||
* \param[in] origin the origin of the coordinate system
|
||||
* \param[in] x_direction the first axis
|
||||
* \param[in] y_direction the second axis
|
||||
* \param[in] norm_limit the limit to ignore norm rounding errors
|
||||
* \param[in] dot_limit the limit to ignore dot product rounding errors
|
||||
* \return True if the coordinate system is consistent, false otherwise.
|
||||
*
|
||||
* Read the other variant for more information
|
||||
*/
|
||||
template <typename Scalar> inline bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<Scalar, 3, 1> &origin,
|
||||
const Eigen::Matrix<Scalar, 3, 1> &x_direction,
|
||||
const Eigen::Matrix<Scalar, 3, 1> &y_direction,
|
||||
const Scalar norm_limit = 1e-3,
|
||||
const Scalar dot_limit = 1e-3)
|
||||
{
|
||||
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> line_x;
|
||||
Eigen::Matrix<Scalar, Eigen::Dynamic, 1> line_y;
|
||||
line_x << origin, x_direction;
|
||||
line_y << origin, y_direction;
|
||||
return (checkCoordinateSystem<Scalar> (line_x, line_y, norm_limit, dot_limit));
|
||||
}
|
||||
|
||||
inline bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<double, 3, 1> &origin,
|
||||
const Eigen::Matrix<double, 3, 1> &x_direction,
|
||||
const Eigen::Matrix<double, 3, 1> &y_direction,
|
||||
const double norm_limit = 1e-3,
|
||||
const double dot_limit = 1e-3)
|
||||
{
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 1> line_x;
|
||||
Eigen::Matrix<double, Eigen::Dynamic, 1> line_y;
|
||||
line_x.resize (6);
|
||||
line_y.resize (6);
|
||||
line_x << origin, x_direction;
|
||||
line_y << origin, y_direction;
|
||||
return (checkCoordinateSystem<double> (line_x, line_y, norm_limit, dot_limit));
|
||||
}
|
||||
|
||||
inline bool
|
||||
checkCoordinateSystem (const Eigen::Matrix<float, 3, 1> &origin,
|
||||
const Eigen::Matrix<float, 3, 1> &x_direction,
|
||||
const Eigen::Matrix<float, 3, 1> &y_direction,
|
||||
const float norm_limit = 1e-3,
|
||||
const float dot_limit = 1e-3)
|
||||
{
|
||||
Eigen::Matrix<float, Eigen::Dynamic, 1> line_x;
|
||||
Eigen::Matrix<float, Eigen::Dynamic, 1> line_y;
|
||||
line_x.resize (6);
|
||||
line_y.resize (6);
|
||||
line_x << origin, x_direction;
|
||||
line_y << origin, y_direction;
|
||||
return (checkCoordinateSystem<float> (line_x, line_y, norm_limit, dot_limit));
|
||||
}
|
||||
|
||||
/** \brief Compute the transformation between two coordinate systems
|
||||
* \param[in] from_line_x X axis from the origin coordinate system
|
||||
* \param[in] from_line_y Y axis from the origin coordinate system
|
||||
* \param[in] to_line_x X axis from the destination coordinate system
|
||||
* \param[in] to_line_y Y axis from the destination coordinate system
|
||||
* \param[out] transformation the transformation matrix to fill
|
||||
* \return true if transformation was filled, false otherwise.
|
||||
*
|
||||
* Line must be filled in this form:\n
|
||||
* line[0-2] = Coordinate system origin coordinates \n
|
||||
* line[3-5] = Direction vector (norm doesn't matter)
|
||||
*/
|
||||
template <typename Scalar> bool
|
||||
transformBetween2CoordinateSystems (const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> from_line_x,
|
||||
const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> from_line_y,
|
||||
const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> to_line_x,
|
||||
const Eigen::Matrix<Scalar, Eigen::Dynamic, 1> to_line_y,
|
||||
Eigen::Transform<Scalar, 3, Eigen::Affine> &transformation);
|
||||
|
||||
inline bool
|
||||
transformBetween2CoordinateSystems (const Eigen::Matrix<double, Eigen::Dynamic, 1> from_line_x,
|
||||
const Eigen::Matrix<double, Eigen::Dynamic, 1> from_line_y,
|
||||
const Eigen::Matrix<double, Eigen::Dynamic, 1> to_line_x,
|
||||
const Eigen::Matrix<double, Eigen::Dynamic, 1> to_line_y,
|
||||
Eigen::Transform<double, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
return (transformBetween2CoordinateSystems<double> (from_line_x, from_line_y, to_line_x, to_line_y, transformation));
|
||||
}
|
||||
|
||||
inline bool
|
||||
transformBetween2CoordinateSystems (const Eigen::Matrix<float, Eigen::Dynamic, 1> from_line_x,
|
||||
const Eigen::Matrix<float, Eigen::Dynamic, 1> from_line_y,
|
||||
const Eigen::Matrix<float, Eigen::Dynamic, 1> to_line_x,
|
||||
const Eigen::Matrix<float, Eigen::Dynamic, 1> to_line_y,
|
||||
Eigen::Transform<float, 3, Eigen::Affine> &transformation)
|
||||
{
|
||||
return (transformBetween2CoordinateSystems<float> (from_line_x, from_line_y, to_line_x, to_line_y, transformation));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <pcl/common/impl/eigen.hpp>
|
||||
|
||||
#if defined __SUNPRO_CC
|
||||
# pragma enable_warn
|
||||
#endif
|
||||
123
deps_install/include/pcl-1.10/pcl/common/feature_histogram.h
Executable file
123
deps_install/include/pcl-1.10/pcl/common/feature_histogram.h
Executable file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2014-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <pcl/pcl_macros.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Type for histograms for computing mean and variance of some floats.
|
||||
*
|
||||
* \author Timur Ibadov (ibadov.timur@gmail.com)
|
||||
* \ingroup common
|
||||
*/
|
||||
class PCL_EXPORTS FeatureHistogram
|
||||
{
|
||||
public:
|
||||
/** \brief Public constructor.
|
||||
* \param[in] number_of_bins number of bins in the histogram.
|
||||
* \param[in] min lower threshold.
|
||||
* \param[in] max upper threshold.
|
||||
*/
|
||||
FeatureHistogram (const std::size_t number_of_bins, const float min,
|
||||
const float max);
|
||||
|
||||
/** \brief Public destructor. */
|
||||
virtual ~FeatureHistogram ();
|
||||
|
||||
/** \brief Get the lower threshold.
|
||||
* \return lower threshold.
|
||||
*/
|
||||
float
|
||||
getThresholdMin () const;
|
||||
|
||||
/** \brief Get the upper threshold.
|
||||
* \return upper threshold.
|
||||
*/
|
||||
float
|
||||
getThresholdMax () const;
|
||||
|
||||
/** \brief Get the number of elements was added to the histogram.
|
||||
* \return number of elements in the histogram.
|
||||
*/
|
||||
std::size_t
|
||||
getNumberOfElements () const;
|
||||
|
||||
/** \brief Get number of bins in the histogram.
|
||||
* \return number of bins in the histogram.
|
||||
*/
|
||||
std::size_t
|
||||
getNumberOfBins () const;
|
||||
|
||||
/** \brief Increase a bin, that corresponds the value.
|
||||
* \param[in] value new value.
|
||||
*/
|
||||
void
|
||||
addValue (float value);
|
||||
|
||||
/** \brief Get value, corresponds to the greatest bin.
|
||||
* \return mean value of the greatest bin.
|
||||
*/
|
||||
float
|
||||
getMeanValue ();
|
||||
|
||||
/** \brief Get variance of the value.
|
||||
* \return variance of the greatest bin.
|
||||
*/
|
||||
float
|
||||
getVariance (float mean);
|
||||
|
||||
protected:
|
||||
/** \brief Vector, that contain the histogram. */
|
||||
std::vector <unsigned> histogram_;
|
||||
|
||||
/** \brief Min threshold. */
|
||||
float threshold_min_;
|
||||
/** \brief Max threshold. */
|
||||
float threshold_max_;
|
||||
/** \brief "Width" of a bin. */
|
||||
float step_;
|
||||
|
||||
/** \brief Number of values was added to the histogram. */
|
||||
std::size_t number_of_elements_;
|
||||
|
||||
/** \brief Number of bins. */
|
||||
std::size_t number_of_bins_;
|
||||
};
|
||||
}
|
||||
164
deps_install/include/pcl-1.10/pcl/common/fft/_kiss_fft_guts.h
Executable file
164
deps_install/include/pcl-1.10/pcl/common/fft/_kiss_fft_guts.h
Executable file
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
Copyright (c) 2003-2010, Mark Borgerding
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* kiss_fft.h
|
||||
defines kiss_fft_scalar as either short or a float type
|
||||
and defines
|
||||
struct kiss_fft_cpx { kiss_fft_scalar r; kiss_fft_scalar i; }; */
|
||||
#include "kiss_fft.h"
|
||||
#include <limits.h>
|
||||
|
||||
#define MAXFACTORS 32
|
||||
/* e.g. an fft of length 128 has 4 factors
|
||||
as far as kissfft is concerned
|
||||
4*4*4*2
|
||||
*/
|
||||
|
||||
struct kiss_fft_state{
|
||||
int nfft;
|
||||
int inverse;
|
||||
int factors[2*MAXFACTORS];
|
||||
kiss_fft_cpx twiddles[1];
|
||||
};
|
||||
|
||||
/*
|
||||
Explanation of macros dealing with complex math:
|
||||
|
||||
C_MUL(m,a,b) : m = a*b
|
||||
C_FIXDIV( c , div ) : if a fixed point impl., c /= div. noop otherwise
|
||||
C_SUB( res, a,b) : res = a - b
|
||||
C_SUBFROM( res , a) : res -= a
|
||||
C_ADDTO( res , a) : res += a
|
||||
* */
|
||||
#ifdef FIXED_POINT
|
||||
#if (FIXED_POINT==32)
|
||||
# define FRACBITS 31
|
||||
# define SAMPPROD int64_t
|
||||
#define SAMP_MAX 2147483647
|
||||
#else
|
||||
# define FRACBITS 15
|
||||
# define SAMPPROD int32_t
|
||||
#define SAMP_MAX 32767
|
||||
#endif
|
||||
|
||||
#define SAMP_MIN -SAMP_MAX
|
||||
|
||||
#if defined(CHECK_OVERFLOW)
|
||||
# define CHECK_OVERFLOW_OP(a,op,b) \
|
||||
if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
|
||||
fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) ); }
|
||||
#endif
|
||||
|
||||
|
||||
# define smul(a,b) ( (SAMPPROD)(a)*(b) )
|
||||
# define sround( x ) (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
|
||||
|
||||
# define S_MUL(a,b) sround( smul(a,b) )
|
||||
|
||||
# define C_MUL(m,a,b) \
|
||||
do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
|
||||
(m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
|
||||
|
||||
# define DIVSCALAR(x,k) \
|
||||
(x) = sround( smul( x, SAMP_MAX/k ) )
|
||||
|
||||
# define C_FIXDIV(c,div) \
|
||||
do { DIVSCALAR( (c).r , div); \
|
||||
DIVSCALAR( (c).i , div); }while (0)
|
||||
|
||||
# define C_MULBYSCALAR( c, s ) \
|
||||
do{ (c).r = sround( smul( (c).r , s ) ) ;\
|
||||
(c).i = sround( smul( (c).i , s ) ) ; }while(0)
|
||||
|
||||
#else /* not FIXED_POINT*/
|
||||
|
||||
# define S_MUL(a,b) ( (a)*(b) )
|
||||
#define C_MUL(m,a,b) \
|
||||
do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
|
||||
(m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
|
||||
# define C_FIXDIV(c,div) /* NOOP */
|
||||
# define C_MULBYSCALAR( c, s ) \
|
||||
do{ (c).r *= (s);\
|
||||
(c).i *= (s); }while(0)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_OVERFLOW_OP
|
||||
# define CHECK_OVERFLOW_OP(a,op,b) /* noop */
|
||||
#endif
|
||||
|
||||
#define C_ADD( res, a,b)\
|
||||
do { \
|
||||
CHECK_OVERFLOW_OP((a).r,+,(b).r)\
|
||||
CHECK_OVERFLOW_OP((a).i,+,(b).i)\
|
||||
(res).r=(a).r+(b).r; (res).i=(a).i+(b).i; \
|
||||
}while(0)
|
||||
#define C_SUB( res, a,b)\
|
||||
do { \
|
||||
CHECK_OVERFLOW_OP((a).r,-,(b).r)\
|
||||
CHECK_OVERFLOW_OP((a).i,-,(b).i)\
|
||||
(res).r=(a).r-(b).r; (res).i=(a).i-(b).i; \
|
||||
}while(0)
|
||||
#define C_ADDTO( res , a)\
|
||||
do { \
|
||||
CHECK_OVERFLOW_OP((res).r,+,(a).r)\
|
||||
CHECK_OVERFLOW_OP((res).i,+,(a).i)\
|
||||
(res).r += (a).r; (res).i += (a).i;\
|
||||
}while(0)
|
||||
|
||||
#define C_SUBFROM( res , a)\
|
||||
do {\
|
||||
CHECK_OVERFLOW_OP((res).r,-,(a).r)\
|
||||
CHECK_OVERFLOW_OP((res).i,-,(a).i)\
|
||||
(res).r -= (a).r; (res).i -= (a).i; \
|
||||
}while(0)
|
||||
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase))
|
||||
# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase))
|
||||
# define HALF_OF(x) ((x)>>1)
|
||||
#elif defined(USE_SIMD)
|
||||
# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
|
||||
# define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) )
|
||||
# define HALF_OF(x) ((x)*_mm_set1_ps(.5))
|
||||
#else
|
||||
# define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
|
||||
# define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
|
||||
# define HALF_OF(x) ((x)*.5)
|
||||
#endif
|
||||
|
||||
#define kf_cexp(x,phase) \
|
||||
do{ \
|
||||
(x)->r = KISS_FFT_COS(phase);\
|
||||
(x)->i = KISS_FFT_SIN(phase);\
|
||||
}while(0)
|
||||
|
||||
|
||||
/* a debugging function */
|
||||
#define pcpx(c)\
|
||||
fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
|
||||
|
||||
|
||||
#ifdef KISS_FFT_USE_ALLOCA
|
||||
// define this to allow use of alloca instead of malloc for temporary buffers
|
||||
// Temporary buffers are used in two case:
|
||||
// 1. FFT sizes that have "bad" factors. i.e. not 2,3 and 5
|
||||
// 2. "in-place" FFTs. Notice the quotes, since kissfft does not really do an in-place transform.
|
||||
#include <alloca.h>
|
||||
#define KISS_FFT_TMP_ALLOC(nbytes) alloca(nbytes)
|
||||
#define KISS_FFT_TMP_FREE(ptr)
|
||||
#else
|
||||
#define KISS_FFT_TMP_ALLOC(nbytes) KISS_FFT_MALLOC(nbytes)
|
||||
#define KISS_FFT_TMP_FREE(ptr) KISS_FFT_FREE(ptr)
|
||||
#endif
|
||||
127
deps_install/include/pcl-1.10/pcl/common/fft/kiss_fft.h
Executable file
127
deps_install/include/pcl-1.10/pcl/common/fft/kiss_fft.h
Executable file
@@ -0,0 +1,127 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pcl/pcl_exports.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
ATTENTION!
|
||||
If you would like a :
|
||||
-- a utility that will handle the caching of fft objects
|
||||
-- real-only (no imaginary time component ) FFT
|
||||
-- a multi-dimensional FFT
|
||||
-- a command-line utility to perform ffts
|
||||
-- a command-line utility to perform fast-convolution filtering
|
||||
|
||||
Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
|
||||
in the tools/ directory.
|
||||
*/
|
||||
|
||||
#ifdef USE_SIMD
|
||||
# include <xmmintrin.h>
|
||||
# define kiss_fft_scalar __m128
|
||||
#define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16)
|
||||
#define KISS_FFT_FREE _mm_free
|
||||
#else
|
||||
#define KISS_FFT_MALLOC malloc
|
||||
#define KISS_FFT_FREE free
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
#include <sys/types.h>
|
||||
# if (FIXED_POINT == 32)
|
||||
# define kiss_fft_scalar int32_t
|
||||
# else
|
||||
# define kiss_fft_scalar int16_t
|
||||
# endif
|
||||
#else
|
||||
# ifndef kiss_fft_scalar
|
||||
/* default is float */
|
||||
# define kiss_fft_scalar float
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
kiss_fft_scalar r;
|
||||
kiss_fft_scalar i;
|
||||
}kiss_fft_cpx;
|
||||
|
||||
typedef struct kiss_fft_state* kiss_fft_cfg;
|
||||
|
||||
/*
|
||||
* kiss_fft_alloc
|
||||
*
|
||||
* Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
|
||||
*
|
||||
* typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
|
||||
*
|
||||
* The return value from fft_alloc is a cfg buffer used internally
|
||||
* by the fft routine or NULL.
|
||||
*
|
||||
* If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
|
||||
* The returned value should be free()d when done to avoid memory leaks.
|
||||
*
|
||||
* The state can be placed in a user supplied buffer 'mem':
|
||||
* If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
|
||||
* then the function places the cfg in mem and the size used in *lenmem
|
||||
* and returns mem.
|
||||
*
|
||||
* If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
|
||||
* then the function returns NULL and places the minimum cfg
|
||||
* buffer size in *lenmem.
|
||||
* */
|
||||
|
||||
kiss_fft_cfg PCL_EXPORTS
|
||||
kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
|
||||
|
||||
/*
|
||||
* kiss_fft(cfg,in_out_buf)
|
||||
*
|
||||
* Perform an FFT on a complex input buffer.
|
||||
* for a forward FFT,
|
||||
* fin should be f[0] , f[1] , ... ,f[nfft-1]
|
||||
* fout will be F[0] , F[1] , ... ,F[nfft-1]
|
||||
* Note that each element is complex and can be accessed like
|
||||
f[k].r and f[k].i
|
||||
* */
|
||||
void PCL_EXPORTS
|
||||
kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
|
||||
|
||||
/*
|
||||
A more generic version of the above function. It reads its input from every Nth sample.
|
||||
* */
|
||||
void PCL_EXPORTS
|
||||
kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
|
||||
|
||||
/* If kiss_fft_alloc allocated a buffer, it is one contiguous
|
||||
buffer and can be simply free()d when no longer needed*/
|
||||
#define kiss_fft_free free
|
||||
|
||||
/*
|
||||
Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
|
||||
your compiler output to call this before you exit.
|
||||
*/
|
||||
void PCL_EXPORTS
|
||||
kiss_fft_cleanup(void);
|
||||
|
||||
/*
|
||||
* Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
|
||||
*/
|
||||
int PCL_EXPORTS
|
||||
kiss_fft_next_fast_size(int n);
|
||||
|
||||
/* for real ffts, we need an even size */
|
||||
#define kiss_fftr_next_fast_size_real(n) \
|
||||
(kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
44
deps_install/include/pcl-1.10/pcl/common/fft/kiss_fftr.h
Executable file
44
deps_install/include/pcl-1.10/pcl/common/fft/kiss_fftr.h
Executable file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "kiss_fft.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
typedef struct kiss_fftr_state *kiss_fftr_cfg;
|
||||
|
||||
|
||||
kiss_fftr_cfg PCL_EXPORTS kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
|
||||
/*
|
||||
nfft must be even
|
||||
|
||||
If you don't care to allocate space, use mem = lenmem = NULL
|
||||
*/
|
||||
|
||||
|
||||
void PCL_EXPORTS kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
|
||||
/*
|
||||
input timedata has nfft scalar points
|
||||
output freqdata has nfft/2+1 complex points
|
||||
*/
|
||||
|
||||
void PCL_EXPORTS kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
|
||||
/*
|
||||
input freqdata has nfft/2+1 complex points
|
||||
output timedata has nfft scalar points
|
||||
*/
|
||||
|
||||
#define kiss_fftr_free free
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
85
deps_install/include/pcl-1.10/pcl/common/file_io.h
Executable file
85
deps_install/include/pcl-1.10/pcl/common/file_io.h
Executable file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010, Willow Garage, Inc.
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
* \file pcl/common/file_io.h
|
||||
* Define some helper functions for reading and writing files
|
||||
* \ingroup common
|
||||
* \todo move this to pcl::console
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
namespace pcl
|
||||
{
|
||||
/** \brief Find all *.pcd files in the directory and return them sorted
|
||||
* \param directory the directory to be searched
|
||||
* \param file_names the resulting (sorted) list of .pcd files
|
||||
*/
|
||||
inline void
|
||||
getAllPcdFilesInDirectory (const std::string& directory, std::vector<std::string>& file_names);
|
||||
|
||||
/** \brief Remove the path from the given string and return only the filename (the remaining string after the
|
||||
* last '/')
|
||||
* \param input the input filename (with full path)
|
||||
* \return the resulting filename, stripped of the path
|
||||
*/
|
||||
inline std::string
|
||||
getFilenameWithoutPath (const std::string& input);
|
||||
|
||||
/** \brief Remove the extension from the given string and return only the filename (everything before the last '.')
|
||||
* \param input the input filename (with the file extension)
|
||||
* \return the resulting filename, stripped of its extension
|
||||
*/
|
||||
inline std::string
|
||||
getFilenameWithoutExtension (const std::string& input);
|
||||
|
||||
/** \brief Get the file extension from the given string (the remaining string after the last '.')
|
||||
* \param input the input filename
|
||||
* \return \a input 's file extension
|
||||
*/
|
||||
inline std::string
|
||||
getFileExtension (const std::string& input);
|
||||
} // namespace end
|
||||
/*@}*/
|
||||
#include <pcl/common/impl/file_io.hpp>
|
||||
262
deps_install/include/pcl-1.10/pcl/common/gaussian.h
Executable file
262
deps_install/include/pcl-1.10/pcl/common/gaussian.h
Executable file
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2011, Willow Garage, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/common/eigen.h>
|
||||
#include <pcl/point_cloud.h>
|
||||
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
/** Class GaussianKernel assembles all the method for computing,
|
||||
* convolving, smoothing, gradients computing an image using
|
||||
* a gaussian kernel. The image is stored in point cloud elements
|
||||
* intensity member or rgb or...
|
||||
* \author Nizar Sallem
|
||||
* \ingroup common
|
||||
*/
|
||||
class PCL_EXPORTS GaussianKernel
|
||||
{
|
||||
public:
|
||||
|
||||
static const unsigned MAX_KERNEL_WIDTH = 71;
|
||||
/** Computes the gaussian kernel and dervative assiociated to sigma.
|
||||
* The kernel and derivative width are adjusted according.
|
||||
* \param[in] sigma
|
||||
* \param[out] kernel the computed gaussian kernel
|
||||
* \param[in] kernel_width the desired kernel width upper bond
|
||||
* \throws pcl::KernelWidthTooSmallException
|
||||
*/
|
||||
void
|
||||
compute (float sigma,
|
||||
Eigen::VectorXf &kernel,
|
||||
unsigned kernel_width = MAX_KERNEL_WIDTH) const;
|
||||
|
||||
/** Computes the gaussian kernel and dervative assiociated to sigma.
|
||||
* The kernel and derivative width are adjusted according.
|
||||
* \param[in] sigma
|
||||
* \param[out] kernel the computed gaussian kernel
|
||||
* \param[out] derivative the computed kernel derivative
|
||||
* \param[in] kernel_width the desired kernel width upper bond
|
||||
* \throws pcl::KernelWidthTooSmallException
|
||||
*/
|
||||
void
|
||||
compute (float sigma,
|
||||
Eigen::VectorXf &kernel,
|
||||
Eigen::VectorXf &derivative,
|
||||
unsigned kernel_width = MAX_KERNEL_WIDTH) const;
|
||||
|
||||
/** Convolve a float image rows by a given kernel.
|
||||
* \param[in] kernel convolution kernel
|
||||
* \param[in] input the image to convolve
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
void
|
||||
convolveRows (const pcl::PointCloud<float> &input,
|
||||
const Eigen::VectorXf &kernel,
|
||||
pcl::PointCloud<float> &output) const;
|
||||
|
||||
/** Convolve a float image rows by a given kernel.
|
||||
* \param[in] input the image to convolve
|
||||
* \param[in] field_accessor a field accessor
|
||||
* \param[in] kernel convolution kernel
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
template <typename PointT> void
|
||||
convolveRows (const pcl::PointCloud<PointT> &input,
|
||||
std::function <float (const PointT& p)> field_accessor,
|
||||
const Eigen::VectorXf &kernel,
|
||||
pcl::PointCloud<float> &output) const;
|
||||
|
||||
/** Convolve a float image columns by a given kernel.
|
||||
* \param[in] input the image to convolve
|
||||
* \param[in] kernel convolution kernel
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
void
|
||||
convolveCols (const pcl::PointCloud<float> &input,
|
||||
const Eigen::VectorXf &kernel,
|
||||
pcl::PointCloud<float> &output) const;
|
||||
|
||||
/** Convolve a float image columns by a given kernel.
|
||||
* \param[in] input the image to convolve
|
||||
* \param[in] field_accessor a field accessor
|
||||
* \param[in] kernel convolution kernel
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
template <typename PointT> void
|
||||
convolveCols (const pcl::PointCloud<PointT> &input,
|
||||
std::function <float (const PointT& p)> field_accessor,
|
||||
const Eigen::VectorXf &kernel,
|
||||
pcl::PointCloud<float> &output) const;
|
||||
|
||||
/** Convolve a float image in the 2 directions
|
||||
* \param[in] horiz_kernel kernel for convolving rows
|
||||
* \param[in] vert_kernel kernel for convolving columns
|
||||
* \param[in] input image to convolve
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
inline void
|
||||
convolve (const pcl::PointCloud<float> &input,
|
||||
const Eigen::VectorXf &horiz_kernel,
|
||||
const Eigen::VectorXf &vert_kernel,
|
||||
pcl::PointCloud<float> &output) const
|
||||
{
|
||||
std::cout << ">>> convolve cpp" << std::endl;
|
||||
pcl::PointCloud<float> tmp (input.width, input.height) ;
|
||||
convolveRows (input, horiz_kernel, tmp);
|
||||
convolveCols (tmp, vert_kernel, output);
|
||||
std::cout << "<<< convolve cpp" << std::endl;
|
||||
}
|
||||
|
||||
/** Convolve a float image in the 2 directions
|
||||
* \param[in] input image to convolve
|
||||
* \param[in] field_accessor a field accessor
|
||||
* \param[in] horiz_kernel kernel for convolving rows
|
||||
* \param[in] vert_kernel kernel for convolving columns
|
||||
* \param[out] output the convolved image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
convolve (const pcl::PointCloud<PointT> &input,
|
||||
std::function <float (const PointT& p)> field_accessor,
|
||||
const Eigen::VectorXf &horiz_kernel,
|
||||
const Eigen::VectorXf &vert_kernel,
|
||||
pcl::PointCloud<float> &output) const
|
||||
{
|
||||
std::cout << ">>> convolve hpp" << std::endl;
|
||||
pcl::PointCloud<float> tmp (input.width, input.height);
|
||||
convolveRows<PointT>(input, field_accessor, horiz_kernel, tmp);
|
||||
convolveCols(tmp, vert_kernel, output);
|
||||
std::cout << "<<< convolve hpp" << std::endl;
|
||||
}
|
||||
|
||||
/** Computes float image gradients using a gaussian kernel and gaussian kernel
|
||||
* derivative.
|
||||
* \param[in] input image to compute gardients for
|
||||
* \param[in] gaussian_kernel the gaussian kernel to be used
|
||||
* \param[in] gaussian_kernel_derivative the associated derivative
|
||||
* \param[out] grad_x gradient along X direction
|
||||
* \param[out] grad_y gradient along Y direction
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
inline void
|
||||
computeGradients (const pcl::PointCloud<float> &input,
|
||||
const Eigen::VectorXf &gaussian_kernel,
|
||||
const Eigen::VectorXf &gaussian_kernel_derivative,
|
||||
pcl::PointCloud<float> &grad_x,
|
||||
pcl::PointCloud<float> &grad_y) const
|
||||
{
|
||||
convolve (input, gaussian_kernel_derivative, gaussian_kernel, grad_x);
|
||||
convolve (input, gaussian_kernel, gaussian_kernel_derivative, grad_y);
|
||||
}
|
||||
|
||||
/** Computes float image gradients using a gaussian kernel and gaussian kernel
|
||||
* derivative.
|
||||
* \param[in] input image to compute gardients for
|
||||
* \param[in] field_accessor a field accessor
|
||||
* \param[in] gaussian_kernel the gaussian kernel to be used
|
||||
* \param[in] gaussian_kernel_derivative the associated derivative
|
||||
* \param[out] grad_x gradient along X direction
|
||||
* \param[out] grad_y gradient along Y direction
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
computeGradients (const pcl::PointCloud<PointT> &input,
|
||||
std::function <float (const PointT& p)> field_accessor,
|
||||
const Eigen::VectorXf &gaussian_kernel,
|
||||
const Eigen::VectorXf &gaussian_kernel_derivative,
|
||||
pcl::PointCloud<float> &grad_x,
|
||||
pcl::PointCloud<float> &grad_y) const
|
||||
{
|
||||
convolve<PointT> (input, field_accessor, gaussian_kernel_derivative, gaussian_kernel, grad_x);
|
||||
convolve<PointT> (input, field_accessor, gaussian_kernel, gaussian_kernel_derivative, grad_y);
|
||||
}
|
||||
|
||||
/** Smooth image using a gaussian kernel.
|
||||
* \param[in] input image
|
||||
* \param[in] gaussian_kernel the gaussian kernel to be used
|
||||
* \param[out] output the smoothed image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
inline void
|
||||
smooth (const pcl::PointCloud<float> &input,
|
||||
const Eigen::VectorXf &gaussian_kernel,
|
||||
pcl::PointCloud<float> &output) const
|
||||
{
|
||||
convolve (input, gaussian_kernel, gaussian_kernel, output);
|
||||
}
|
||||
|
||||
/** Smooth image using a gaussian kernel.
|
||||
* \param[in] input image
|
||||
* \param[in] field_accessor a field accessor
|
||||
* \param[in] gaussian_kernel the gaussian kernel to be used
|
||||
* \param[out] output the smoothed image
|
||||
* \note if output doesn't fit in input i.e. output.rows () < input.rows () or
|
||||
* output.cols () < input.cols () then output is resized to input sizes.
|
||||
*/
|
||||
template <typename PointT> inline void
|
||||
smooth (const pcl::PointCloud<PointT> &input,
|
||||
std::function <float (const PointT& p)> field_accessor,
|
||||
const Eigen::VectorXf &gaussian_kernel,
|
||||
pcl::PointCloud<float> &output) const
|
||||
{
|
||||
convolve<PointT> (input, field_accessor, gaussian_kernel, gaussian_kernel, output);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#include <pcl/common/impl/gaussian.hpp>
|
||||
186
deps_install/include/pcl-1.10/pcl/common/generate.h
Executable file
186
deps_install/include/pcl-1.10/pcl/common/generate.h
Executable file
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2010-2012, Willow Garage, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/common/random.h>
|
||||
|
||||
namespace pcl
|
||||
{
|
||||
|
||||
namespace common
|
||||
{
|
||||
/** \brief CloudGenerator class generates a point cloud using some randoom number generator.
|
||||
* Generators can be found in \file common/random.h and easily extensible.
|
||||
*
|
||||
* \ingroup common
|
||||
* \author Nizar Sallem
|
||||
*/
|
||||
template <typename PointT, typename GeneratorT>
|
||||
class CloudGenerator
|
||||
{
|
||||
public:
|
||||
using GeneratorParameters = typename GeneratorT::Parameters;
|
||||
|
||||
/// Default constructor
|
||||
CloudGenerator ();
|
||||
|
||||
/** Constructor with single generator to ensure all X, Y and Z values are within same range
|
||||
* \param params parameters for X, Y and Z values generation. Uniqueness is ensured through
|
||||
* seed incrementation
|
||||
*/
|
||||
CloudGenerator (const GeneratorParameters& params);
|
||||
|
||||
/** Constructor with independent generators per axis
|
||||
* \param x_params parameters for x values generation
|
||||
* \param y_params parameters for y values generation
|
||||
* \param z_params parameters for z values generation
|
||||
*/
|
||||
CloudGenerator (const GeneratorParameters& x_params,
|
||||
const GeneratorParameters& y_params,
|
||||
const GeneratorParameters& z_params);
|
||||
|
||||
/** Set parameters for x, y and z values. Uniqueness is ensured through seed incrementation.
|
||||
* \param params parameteres for X, Y and Z values generation.
|
||||
*/
|
||||
void
|
||||
setParameters (const GeneratorParameters& params);
|
||||
|
||||
/** Set parameters for x values generation
|
||||
* \param x_params parameters for x values generation
|
||||
*/
|
||||
void
|
||||
setParametersForX (const GeneratorParameters& x_params);
|
||||
|
||||
/** Set parameters for y values generation
|
||||
* \param y_params parameters for y values generation
|
||||
*/
|
||||
void
|
||||
setParametersForY (const GeneratorParameters& y_params);
|
||||
|
||||
/** Set parameters for z values generation
|
||||
* \param z_params parameters for z values generation
|
||||
*/
|
||||
void
|
||||
setParametersForZ (const GeneratorParameters& z_params);
|
||||
|
||||
/// \return x values generation parameters
|
||||
const GeneratorParameters&
|
||||
getParametersForX () const;
|
||||
|
||||
/// \return y values generation parameters
|
||||
const GeneratorParameters&
|
||||
getParametersForY () const;
|
||||
|
||||
/// \return z values generation parameters
|
||||
const GeneratorParameters&
|
||||
getParametersForZ () const;
|
||||
|
||||
/// \return a single random generated point
|
||||
PointT
|
||||
get ();
|
||||
|
||||
/** Generates a cloud with X Y Z picked within given ranges. This function assumes that
|
||||
* cloud is properly defined else it raises errors and does nothing.
|
||||
* \param[out] cloud cloud to generate coordinates for
|
||||
* \return 0 if generation went well else -1.
|
||||
*/
|
||||
int
|
||||
fill (pcl::PointCloud<PointT>& cloud);
|
||||
|
||||
/** Generates a cloud of specified dimensions with X Y Z picked within given ranges.
|
||||
* \param[in] width width of generated cloud
|
||||
* \param[in] height height of generated cloud
|
||||
* \param[out] cloud output cloud
|
||||
* \return 0 if generation went well else -1.
|
||||
*/
|
||||
int
|
||||
fill (int width, int height, pcl::PointCloud<PointT>& cloud);
|
||||
|
||||
private:
|
||||
GeneratorT x_generator_, y_generator_, z_generator_;
|
||||
};
|
||||
|
||||
template <typename GeneratorT>
|
||||
class CloudGenerator<pcl::PointXY, GeneratorT>
|
||||
{
|
||||
public:
|
||||
using GeneratorParameters = typename GeneratorT::Parameters;
|
||||
|
||||
CloudGenerator ();
|
||||
|
||||
CloudGenerator (const GeneratorParameters& params);
|
||||
|
||||
CloudGenerator (const GeneratorParameters& x_params,
|
||||
const GeneratorParameters& y_params);
|
||||
|
||||
void
|
||||
setParameters (const GeneratorParameters& params);
|
||||
|
||||
void
|
||||
setParametersForX (const GeneratorParameters& x_params);
|
||||
|
||||
void
|
||||
setParametersForY (const GeneratorParameters& y_params);
|
||||
|
||||
const GeneratorParameters&
|
||||
getParametersForX () const;
|
||||
|
||||
const GeneratorParameters&
|
||||
getParametersForY () const;
|
||||
|
||||
pcl::PointXY
|
||||
get ();
|
||||
|
||||
int
|
||||
fill (pcl::PointCloud<pcl::PointXY>& cloud);
|
||||
|
||||
int
|
||||
fill (int width, int height, pcl::PointCloud<pcl::PointXY>& cloud);
|
||||
|
||||
private:
|
||||
GeneratorT x_generator_;
|
||||
GeneratorT y_generator_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#include <pcl/common/impl/generate.hpp>
|
||||
161
deps_install/include/pcl-1.10/pcl/common/geometry.h
Executable file
161
deps_install/include/pcl-1.10/pcl/common/geometry.h
Executable file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Point Cloud Library (PCL) - www.pointclouds.org
|
||||
* Copyright (c) 2012-, Open Perception, Inc.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of the copyright holder(s) nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined __GNUC__
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <Eigen/Core>
|
||||
#include <pcl/console/print.h>
|
||||
|
||||
/**
|
||||
* \file common/geometry.h
|
||||
* Defines some geometrical functions and utility functions
|
||||
* \ingroup common
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
namespace pcl
|
||||
{
|
||||
namespace geometry
|
||||
{
|
||||
/** @return the euclidean distance between 2 points */
|
||||
template <typename PointT> inline float
|
||||
distance (const PointT& p1, const PointT& p2)
|
||||
{
|
||||
Eigen::Vector3f diff = p1.getVector3fMap () - p2.getVector3fMap ();
|
||||
return (diff.norm ());
|
||||
}
|
||||
|
||||
/** @return the squared euclidean distance between 2 points */
|
||||
template<typename PointT> inline float
|
||||
squaredDistance (const PointT& p1, const PointT& p2)
|
||||
{
|
||||
Eigen::Vector3f diff = p1.getVector3fMap () - p2.getVector3fMap ();
|
||||
return (diff.squaredNorm ());
|
||||
}
|
||||
|
||||
/** @return the point projection on a plane defined by its origin and normal vector
|
||||
* \param[in] point Point to be projected
|
||||
* \param[in] plane_origin The plane origin
|
||||
* \param[in] plane_normal The plane normal
|
||||
* \param[out] projected The returned projected point
|
||||
*/
|
||||
template<typename PointT, typename NormalT> inline void
|
||||
project (const PointT& point, const PointT &plane_origin,
|
||||
const NormalT& plane_normal, PointT& projected)
|
||||
{
|
||||
Eigen::Vector3f po = point - plane_origin;
|
||||
const Eigen::Vector3f normal = plane_normal.getVector3fMapConst ();
|
||||
float lambda = normal.dot(po);
|
||||
projected.getVector3fMap () = point.getVector3fMapConst () - (lambda * normal);
|
||||
}
|
||||
|
||||
/** @return the point projection on a plane defined by its origin and normal vector
|
||||
* \param[in] point Point to be projected
|
||||
* \param[in] plane_origin The plane origin
|
||||
* \param[in] plane_normal The plane normal
|
||||
* \param[out] projected The returned projected point
|
||||
*/
|
||||
inline void
|
||||
project (const Eigen::Vector3f& point, const Eigen::Vector3f &plane_origin,
|
||||
const Eigen::Vector3f& plane_normal, Eigen::Vector3f& projected)
|
||||
{
|
||||
Eigen::Vector3f po = point - plane_origin;
|
||||
float lambda = plane_normal.dot(po);
|
||||
projected = point - (lambda * plane_normal);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Given a plane defined by plane_origin and plane_normal, find the unit vector pointing from plane_origin to the projection of point on the plane.
|
||||
*
|
||||
* \param[in] point Point projected on the plane
|
||||
* \param[in] plane_origin The plane origin
|
||||
* \param[in] plane_normal The plane normal
|
||||
* \return unit vector pointing from plane_origin to the projection of point on the plane.
|
||||
* \ingroup geometry
|
||||
*/
|
||||
inline Eigen::Vector3f
|
||||
projectedAsUnitVector (Eigen::Vector3f const &point,
|
||||
Eigen::Vector3f const &plane_origin,
|
||||
Eigen::Vector3f const &plane_normal)
|
||||
{
|
||||
Eigen::Vector3f projection;
|
||||
project (point, plane_origin, plane_normal, projection);
|
||||
Eigen::Vector3f projected_as_unit_vector = projection - plane_origin;
|
||||
projected_as_unit_vector.normalize ();
|
||||
return projected_as_unit_vector;
|
||||
}
|
||||
|
||||
|
||||
/** \brief Define a random unit vector orthogonal to axis.
|
||||
*
|
||||
* \param[in] axis Axis
|
||||
* \return random unit vector orthogonal to axis
|
||||
* \ingroup geometry
|
||||
*/
|
||||
inline Eigen::Vector3f
|
||||
randomOrthogonalAxis (Eigen::Vector3f const &axis)
|
||||
{
|
||||
Eigen::Vector3f rand_ortho_axis;
|
||||
rand_ortho_axis.setRandom();
|
||||
if (std::abs (axis.z ()) > 1E-8f)
|
||||
{
|
||||
rand_ortho_axis.z () = -(axis.x () * rand_ortho_axis.x () + axis.y () * rand_ortho_axis.y ()) / axis.z ();
|
||||
}
|
||||
else if (std::abs (axis.y ()) > 1E-8f)
|
||||
{
|
||||
rand_ortho_axis.y () = -(axis.x () * rand_ortho_axis.x () + axis.z () * rand_ortho_axis.z ()) / axis.y ();
|
||||
}
|
||||
else if (std::abs (axis.x ()) > 1E-8f)
|
||||
{
|
||||
rand_ortho_axis.x () = -(axis.y () * rand_ortho_axis.y () + axis.z () * rand_ortho_axis.z ()) / axis.x ();
|
||||
}
|
||||
else
|
||||
{
|
||||
PCL_WARN ("[pcl::randomOrthogonalAxis] provided axis has norm < 1E-8f");
|
||||
}
|
||||
|
||||
rand_ortho_axis.normalize ();
|
||||
return rand_ortho_axis;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user