Go to the documentation of this file.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
00039 #ifndef PCL_SAMPLE_CONSENSUS_MODEL_REGISTRATION_2D_H_
00040 #define PCL_SAMPLE_CONSENSUS_MODEL_REGISTRATION_2D_H_
00041
00042 #include <pcl/sample_consensus/sac_model_registration.h>
00043
00044 namespace pcl
00045 {
00050 template <typename PointT>
00051 class SampleConsensusModelRegistration2D : public pcl::SampleConsensusModelRegistration<PointT>
00052 {
00053 public:
00054 using pcl::SampleConsensusModelRegistration<PointT>::input_;
00055 using pcl::SampleConsensusModelRegistration<PointT>::target_;
00056 using pcl::SampleConsensusModelRegistration<PointT>::indices_;
00057 using pcl::SampleConsensusModelRegistration<PointT>::indices_tgt_;
00058 using pcl::SampleConsensusModelRegistration<PointT>::error_sqr_dists_;
00059 using pcl::SampleConsensusModelRegistration<PointT>::correspondences_;
00060 using pcl::SampleConsensusModelRegistration<PointT>::sample_dist_thresh_;
00061 using pcl::SampleConsensusModelRegistration<PointT>::computeOriginalIndexMapping;
00062
00063 typedef typename pcl::SampleConsensusModel<PointT>::PointCloud PointCloud;
00064 typedef typename pcl::SampleConsensusModel<PointT>::PointCloudPtr PointCloudPtr;
00065 typedef typename pcl::SampleConsensusModel<PointT>::PointCloudConstPtr PointCloudConstPtr;
00066
00067 typedef boost::shared_ptr<SampleConsensusModelRegistration2D> Ptr;
00068 typedef boost::shared_ptr<const SampleConsensusModelRegistration2D> ConstPtr;
00069
00074 SampleConsensusModelRegistration2D (const PointCloudConstPtr &cloud,
00075 bool random = false)
00076 : pcl::SampleConsensusModelRegistration<PointT> (cloud, random)
00077 , projection_matrix_ (Eigen::Matrix3f::Identity ())
00078 {
00079
00080 setInputCloud (cloud);
00081 }
00082
00088 SampleConsensusModelRegistration2D (const PointCloudConstPtr &cloud,
00089 const std::vector<int> &indices,
00090 bool random = false)
00091 : pcl::SampleConsensusModelRegistration<PointT> (cloud, indices, random)
00092 , projection_matrix_ (Eigen::Matrix3f::Identity ())
00093 {
00094 computeOriginalIndexMapping ();
00095 computeSampleDistanceThreshold (cloud, indices);
00096 }
00097
00099 virtual ~SampleConsensusModelRegistration2D () {}
00100
00105 void
00106 getDistancesToModel (const Eigen::VectorXf &model_coefficients,
00107 std::vector<double> &distances);
00108
00114 void
00115 selectWithinDistance (const Eigen::VectorXf &model_coefficients,
00116 const double threshold,
00117 std::vector<int> &inliers);
00118
00125 virtual int
00126 countWithinDistance (const Eigen::VectorXf &model_coefficients,
00127 const double threshold);
00128
00132 inline void
00133 setProjectionMatrix (const Eigen::Matrix3f &projection_matrix)
00134 { projection_matrix_ = projection_matrix; }
00135
00137 inline Eigen::Matrix3f
00138 getProjectionMatrix () const
00139 { return (projection_matrix_); }
00140
00141 protected:
00146 bool
00147 isSampleGood (const std::vector<int> &samples) const;
00148
00153 inline void
00154 computeSampleDistanceThreshold (const PointCloudConstPtr &cloud)
00155 {
00157
00158
00159
00160
00161
00163
00164
00165
00166
00167
00168
00169
00170
00172
00173
00174
00175 }
00176
00181 inline void
00182 computeSampleDistanceThreshold (const PointCloudConstPtr &cloud,
00183 const std::vector<int> &indices)
00184 {
00186
00187
00188
00189
00191
00192
00193
00194
00195
00196
00197
00198
00200
00201
00202
00203 }
00204
00205 private:
00207 Eigen::Matrix3f projection_matrix_;
00208
00209 public:
00210 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
00211 };
00212 }
00213
00214 #include <pcl/sample_consensus/impl/sac_model_registration_2d.hpp>
00215
00216 #endif // PCL_SAMPLE_CONSENSUS_MODEL_REGISTRATION_2D_H_
00217