40 #include <pcl/recognition/hv/hypotheses_verification.h>
53 template<
typename ModelT,
typename SceneT>
66 class RecognitionModel
69 std::vector<int> explained_;
72 int good_information_;
77 using RecognitionModelPtr = std::shared_ptr<RecognitionModel>;
82 struct sortModelsClass
85 operator() (
const RecognitionModelPtr & n1,
const RecognitionModelPtr & n2)
87 float val1 =
static_cast<float>(n1->good_information_) -
static_cast<float>(n1->bad_information_) * n1->regularizer_;
88 float val2 =
static_cast<float>(n2->good_information_) -
static_cast<float>(n2->bad_information_) * n2->regularizer_;
100 RecognitionModelPtr model_;
106 struct sortModelIndicesClass
109 operator() (
const modelIndices & n1,
const modelIndices & n2)
111 float val1 =
static_cast<float>(n1.model_->good_information_) -
static_cast<float>(n1.model_->bad_information_) * n1.model_->regularizer_;
112 float val2 =
static_cast<float>(n2.model_->good_information_) -
static_cast<float>(n2.model_->bad_information_) * n2.model_->regularizer_;
115 } sortModelsIndicesOp;
118 std::vector<modelIndices> indices_models_;
121 std::vector<RecognitionModelPtr> recognition_models_;
124 std::vector<std::vector<RecognitionModelPtr>> points_explained_by_rm_;
137 indices_models_.clear ();
138 for (std::size_t i = 0; i < recognition_models_.size (); i++)
141 mi.index_ =
static_cast<int> (i);
142 mi.model_ = recognition_models_[i];
143 indices_models_.push_back (mi);
146 std::sort (indices_models_.begin (), indices_models_.end (), sortModelsIndicesOp);
148 std::sort (recognition_models_.begin (), recognition_models_.end (), sortModelsOp);
153 updateGoodInformation (
int i)
155 for (std::size_t k = 0; k < recognition_models_[i]->explained_.size (); k++)
158 for (std::size_t kk = 0; kk < points_explained_by_rm_[recognition_models_[i]->explained_[k]].size (); kk++)
160 (points_explained_by_rm_[recognition_models_[i]->explained_[k]])[kk]->good_information_--;
161 (points_explained_by_rm_[recognition_models_[i]->explained_[k]])[kk]->bad_information_++;
183 #ifdef PCL_NO_PRECOMPILE
184 #include <pcl/recognition/impl/hv/greedy_verification.hpp>
A greedy hypothesis verification method.
GreedyVerification(float reg=1.5f)
Constructor.
Abstract class for hypotheses verification methods.
shared_ptr< PointCloud< PointT > > Ptr
Defines all the PCL and non-PCL macros used.