39 #ifndef PCL_REGISTRATION_IA_FPCS_H_ 40 #define PCL_REGISTRATION_IA_FPCS_H_ 42 #include <pcl/common/common.h> 43 #include <pcl/registration/registration.h> 44 #include <pcl/registration/matching_candidate.h> 54 template <
typename Po
intT>
inline float 64 template <
typename Po
intT>
inline float 66 float max_dist,
int nr_threads = 1);
69 namespace registration
77 template <
typename Po
intSource,
typename Po
intTarget,
typename NormalT = pcl::Normal,
typename Scalar =
float>
82 typedef boost::shared_ptr <FPCSInitialAlignment <PointSource, PointTarget, NormalT, Scalar> >
Ptr;
83 typedef boost::shared_ptr <const FPCSInitialAlignment <PointSource, PointTarget, NormalT, Scalar> >
ConstPtr;
94 typedef typename Normals::ConstPtr NormalsConstPtr;
139 inline NormalsConstPtr
156 inline NormalsConstPtr
329 selectBase (std::vector <int> &base_indices,
float (&ratio)[2]);
349 setupBase (std::vector <int> &base_indices,
float (&ratio)[2]);
386 const std::vector <int> &base_indices,
387 std::vector <std::vector <int> > &matches,
390 const float (&ratio)[2]);
401 checkBaseMatch (
const std::vector <int> &match_indices,
const float (&ds)[4]);
414 const std::vector <int> &base_indices,
415 std::vector <std::vector <int> > &matches,
416 MatchingCandidates &candidates);
427 const std::vector <int> &base_indices,
428 std::vector <int> &match_indices,
445 const std::vector <int> &base_indices,
446 const std::vector <int> &match_indices,
448 Eigen::Matrix4f &transformation);
469 finalCompute (
const std::vector <MatchingCandidates > &candidates);
569 #include <pcl/registration/impl/ia_fpcs.hpp> 571 #endif // PCL_REGISTRATION_IA_FPCS_H_ virtual void linkMatchWithBase(const std::vector< int > &base_indices, std::vector< int > &match_indices, pcl::Correspondences &correspondences)
Sets the correspondences between the base B and the match M by using the distance of each point to th...
NormalsConstPtr target_normals_
Normals of target point cloud.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
std::vector< MatchingCandidate, Eigen::aligned_allocator< MatchingCandidate > > MatchingCandidates
virtual bool initCompute()
Internal computation initialization.
virtual void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess)
Rigid transformation computation method.
float getScoreThreshold() const
float getMaxNormalDifference() const
NormalsConstPtr source_normals_
Normals of source point cloud.
float max_base_diameter_sqr_
Estimated squared metric overlap between source and target.
FPCSInitialAlignment computes corresponding four point congruent sets as described in: "4-points cong...
boost::shared_ptr< std::vector< int > > IndicesPtr
boost::shared_ptr< const Registration< PointSource, PointTarget, Scalar > > ConstPtr
virtual int validateTransformation(Eigen::Matrix4f &transformation, float &fitness_score)
Validate the transformation by calculating the number of inliers after transforming the source cloud...
void setNumberOfSamples(int nr_samples)
Set the number of source samples to use during alignment.
int nr_threads_
Number of threads for parallelization (standard = 1).
float getApproxOverlap() const
IndicesPtr getTargetIndices() const
float approx_overlap_
Estimated overlap between source and target (standard = 0.5).
pcl::PointCloud< PointTarget > PointCloudTarget
virtual ~FPCSInitialAlignment()
Destructor.
int getMaxComputationTime() const
bool use_normals_
Use normals flag.
void setMaxNormalDifference(float max_norm_diff)
Set the maximum normal difference between valid point correspondences in degree.
int nr_samples_
The number of points to uniformly sample the source point cloud.
pcl::IndicesPtr target_indices_
A pointer to the vector of target point indices to use after sampling.
boost::shared_ptr< Registration< PointSource, PointTarget, Scalar > > Ptr
Container for matching candidate consisting of.
pcl::search::KdTree< PointSource > KdTreeReciprocal
VectorType::iterator iterator
void setupBase(std::vector< int > &base_indices, float(&ratio)[2])
Setup the base (four coplanar points) by ordering the points and computing intersection ratios and se...
int selectBase(std::vector< int > &base_indices, float(&ratio)[2])
Select an approximately coplanar set of four points from the source cloud.
void setNumberOfThreads(int nr_threads)
Set the number of used threads if OpenMP is activated.
FPCSInitialAlignment()
Constructor.
virtual int validateMatch(const std::vector< int > &base_indices, const std::vector< int > &match_indices, const pcl::Correspondences &correspondences, Eigen::Matrix4f &transformation)
Validate the matching by computing the transformation between the source and target based on the four...
PointCloudSource::Ptr PointCloudSourcePtr
boost::shared_ptr< PointCloud< PointSource > > Ptr
void setTargetNormals(const NormalsConstPtr &target_normals)
Provide a pointer to the normals of the target point cloud.
void setMaxComputationTime(int max_runtime)
Set the maximum computation time in seconds.
float max_inlier_dist_sqr_
Maximal squared point distance between source and target points to count as inlier.
void setScoreThreshold(float score_threshold)
Set the scoring threshold used for early finishing the method.
const float small_error_
Definition of a small error.
float segmentToSegmentDist(const std::vector< int > &base_indices, float(&ratio)[2])
Calculate intersection ratios and segment to segment distances of base diagonals. ...
void setTargetIndices(const IndicesPtr &target_indices)
Provide a pointer to the vector of target indices.
boost::shared_ptr< KdTree< PointT, Tree > > Ptr
float score_threshold_
Score threshold to stop calculation with success.
virtual void handleMatches(const std::vector< int > &base_indices, std::vector< std::vector< int > > &matches, MatchingCandidates &candidates)
Method to handle current candidate matches.
float delta_
Delta value of 4pcs algorithm (standard = 1.0).
int getNumberOfThreads() const
int getNumberOfSamples() const
float max_pair_diff_
Maximal difference between corresponding point pairs in source and target.
pcl::IndicesPtr source_indices_
A pointer to the vector of source point indices to use after sampling.
virtual void finalCompute(const std::vector< MatchingCandidates > &candidates)
Final computation of best match out of vector of best matches.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
float getMeanPointDensity(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, float max_dist, int nr_threads=1)
Compute the mean point density of a given point cloud.
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
virtual int bruteForceCorrespondences(int idx1, int idx2, pcl::Correspondences &pairs)
Search for corresponding point pairs given the distance between two base points.
float max_edge_diff_
Maximal difference between the length of the base edges and valid match edges.
void setApproxOverlap(float approx_overlap)
Set the approximate overlap between source and target.
Registration represents the base registration class for general purpose, ICP-like methods...
void setSourceNormals(const NormalsConstPtr &source_normals)
Provide a pointer to the normals of the source point cloud.
float max_norm_diff_
Maximum normal difference of corresponding point pairs in degrees (standard = 90).
float fitness_score_
Resulting fitness score of the best match.
NormalsConstPtr getSourceNormals() const
float diameter_
Estimated diamter of the target point cloud.
KdTreeReciprocal::Ptr KdTreeReciprocalPtr
bool normalize_delta_
Normalize delta flag.
float coincidation_limit_
Maximal distance between coinciding intersection points to find valid matches.
virtual int determineBaseMatches(const std::vector< int > &base_indices, std::vector< std::vector< int > > &matches, const pcl::Correspondences &pairs_a, const pcl::Correspondences &pairs_b, const float(&ratio)[2])
Determine base matches by combining the point pair candidate and search for coinciding intersection p...
void setDelta(float delta, bool normalize=false)
Set the constant factor delta which weights the internally calculated parameters. ...
float max_mse_
Maximal mean squared errors of a transformation calculated from a candidate match.
pcl::PointCloud< PointSource > PointCloudSource
float getFitnessScore() const
int checkBaseMatch(const std::vector< int > &match_indices, const float(&ds)[4])
Check if outer rectangle distance of matched points fit with the base rectangle.
int max_runtime_
Maximum allowed computation time in seconds (standard = 0 => ~unlimited).
NormalsConstPtr getTargetNormals() const
int selectBaseTriangle(std::vector< int > &base_indices)
Select randomly a triplet of points with large point-to-point distances.