00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PCL_SAMPLE_CONSENSUS_MODEL_NORMALPARALLELPLANE_H_
00039 #define PCL_SAMPLE_CONSENSUS_MODEL_NORMALPARALLELPLANE_H_
00040
00041 #include <pcl/sample_consensus/sac_model.h>
00042 #include <pcl/sample_consensus/sac_model_plane.h>
00043 #include <pcl/sample_consensus/sac_model_perpendicular_plane.h>
00044 #include <pcl/sample_consensus/model_types.h>
00045
00046 #include <pcl/features/normal_3d.h>
00047
00048 namespace pcl
00049 {
00053
00057 template <typename PointT, typename PointNT>
00058 class SampleConsensusModelNormalParallelPlane : public SampleConsensusModelPlane<PointT>, public SampleConsensusModelFromNormals<PointT, PointNT>
00059 {
00060 using SampleConsensusModel<PointT>::input_;
00061 using SampleConsensusModel<PointT>::indices_;
00062 using SampleConsensusModelFromNormals<PointT, PointNT>::normals_;
00063 using SampleConsensusModelFromNormals<PointT, PointNT>::normal_distance_weight_;
00064
00065 public:
00066
00067 typedef typename SampleConsensusModel<PointT>::PointCloud PointCloud;
00068 typedef typename SampleConsensusModel<PointT>::PointCloudPtr PointCloudPtr;
00069 typedef typename SampleConsensusModel<PointT>::PointCloudConstPtr PointCloudConstPtr;
00070
00071 typedef typename SampleConsensusModelFromNormals<PointT, PointNT>::PointCloudNPtr PointCloudNPtr;
00072 typedef typename SampleConsensusModelFromNormals<PointT, PointNT>::PointCloudNConstPtr PointCloudNConstPtr;
00073
00074 typedef boost::shared_ptr<SampleConsensusModelNormalParallelPlane> Ptr;
00075
00079 SampleConsensusModelNormalParallelPlane (const PointCloudConstPtr &cloud) : SampleConsensusModelPlane<PointT> (cloud),
00080 eps_angle_ (0.0), eps_dist_ (0.0)
00081 {
00082 axis_.setZero ();
00083 }
00084
00089 SampleConsensusModelNormalParallelPlane (const PointCloudConstPtr &cloud, const std::vector<int> &indices) : SampleConsensusModelPlane<PointT> (cloud, indices),
00090 eps_angle_ (0.0), eps_dist_ (0.0)
00091 {
00092 axis_.setZero ();
00093 }
00094
00098 inline void setAxis (const Eigen::Vector3f &ax) { axis_ = ax; }
00099
00101 inline Eigen::Vector3f getAxis () { return (axis_); }
00102
00106 inline void setEpsAngle (double ea) { eps_angle_ = ea; }
00107
00109 inline double getEpsAngle () { return (eps_angle_); }
00110
00114 inline void setDistanceFromOrigin (double d) { distance_from_origin_ = d; }
00115
00117 inline double getDistanceFromOrigin () { return (distance_from_origin_); }
00118
00122 inline void setEpsDist (double delta) { eps_dist_ = delta; }
00123
00125 inline double getEpsDist () { return (eps_dist_); }
00126
00132 void selectWithinDistance (const Eigen::VectorXf &model_coefficients, double threshold, std::vector<int> &inliers);
00133
00138 void getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector<double> &distances);
00139
00141 inline pcl::SacModel getModelType () const { return (SACMODEL_NORMAL_PARALLEL_PLANE); }
00142
00143 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00144
00145 protected:
00149 bool isModelValid (const Eigen::VectorXf &model_coefficients);
00150
00151 private:
00153 Eigen::Vector3f axis_;
00154
00156 double distance_from_origin_;
00157
00159 double eps_angle_;
00160
00162 double eps_dist_;
00163 };
00164 }
00165
00166 #endif //#ifndef PCL_SAMPLE_CONSENSUS_MODEL_NORMALPARALLELPLANE_H_