41 #include <pcl/registration/matching_candidate.h>
42 #include <pcl/registration/registration.h>
51 template <
typename Po
intT>
64 template <
typename Po
intT>
71 namespace registration {
77 template <
typename PointSource,
80 typename Scalar =
float>
85 shared_ptr<FPCSInitialAlignment<PointSource, PointTarget, NormalT, Scalar>>;
87 shared_ptr<const FPCSInitialAlignment<PointSource, PointTarget, NormalT, Scalar>>;
98 using NormalsConstPtr =
typename Normals::ConstPtr;
140 inline NormalsConstPtr
156 inline NormalsConstPtr
307 const Eigen::Matrix4f& guess)
override;
379 std::vector<pcl::Indices>& matches,
382 const float (&ratio)[2]);
408 std::vector<pcl::Indices>& matches,
418 PCL_DEPRECATED(1, 18,
"this function has a bug and is generally not needed")
441 Eigen::Matrix4f& transformation);
561 #include <pcl/registration/impl/ia_fpcs.hpp>
typename VectorType::iterator iterator
shared_ptr< PointCloud< PointSource > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Registration represents the base registration class for general purpose, ICP-like methods.
typename KdTreeReciprocal::Ptr KdTreeReciprocalPtr
shared_ptr< const Registration< PointSource, PointTarget, float > > ConstPtr
pcl::PointCloud< PointSource > PointCloudSource
typename PointCloudSource::Ptr PointCloudSourcePtr
shared_ptr< Registration< PointSource, PointTarget, float > > Ptr
FPCSInitialAlignment computes corresponding four point congruent sets as described in: "4-points cong...
virtual void finalCompute(const std::vector< MatchingCandidates > &candidates)
Final computation of best match out of vector of best matches.
void setTargetNormals(const NormalsConstPtr &target_normals)
Provide a pointer to the normals of the target point cloud.
void setupBase(pcl::Indices &base_indices, float(&ratio)[2])
Setup the base (four coplanar points) by ordering the points and computing intersection ratios and se...
bool use_normals_
Use normals flag.
int selectBaseTriangle(pcl::Indices &base_indices)
Select randomly a triplet of points with large point-to-point distances.
float max_edge_diff_
Maximal difference between the length of the base edges and valid match edges.
int getNumberOfThreads() const
virtual int bruteForceCorrespondences(int idx1, int idx2, pcl::Correspondences &pairs)
Search for corresponding point pairs given the distance between two base points.
float delta_
Delta value of 4pcs algorithm (standard = 1.0).
int selectBase(pcl::Indices &base_indices, float(&ratio)[2])
Select an approximately coplanar set of four points from the source cloud.
int getNumberOfSamples() const
void setNumberOfSamples(int nr_samples)
Set the number of source samples to use during alignment.
float max_base_diameter_sqr_
Estimated squared metric overlap between source and target.
float coincidation_limit_
Maximal distance between coinciding intersection points to find valid matches.
virtual int validateTransformation(Eigen::Matrix4f &transformation, float &fitness_score)
Validate the transformation by calculating the number of inliers after transforming the source cloud.
virtual int determineBaseMatches(const pcl::Indices &base_indices, std::vector< pcl::Indices > &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...
virtual void linkMatchWithBase(const pcl::Indices &base_indices, pcl::Indices &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...
float getFitnessScore() const
virtual void handleMatches(const pcl::Indices &base_indices, std::vector< pcl::Indices > &matches, MatchingCandidates &candidates)
Method to handle current candidate matches.
float max_inlier_dist_sqr_
Maximal squared point distance between source and target points to count as inlier.
bool normalize_delta_
Normalize delta flag.
void setScoreThreshold(float score_threshold)
Set the scoring threshold used for early finishing the method.
NormalsConstPtr target_normals_
Normals of target point cloud.
NormalsConstPtr source_normals_
Normals of source point cloud.
pcl::IndicesPtr target_indices_
A pointer to the vector of target point indices to use after sampling.
void setMaxNormalDifference(float max_norm_diff)
Set the maximum normal difference between valid point correspondences in degree.
float max_mse_
Maximal mean squared errors of a transformation calculated from a candidate match.
int checkBaseMatch(const pcl::Indices &match_indices, const float(&ds)[4])
Check if outer rectangle distance of matched points fit with the base rectangle.
int nr_samples_
The number of points to uniformly sample the source point cloud.
float approx_overlap_
Estimated overlap between source and target (standard = 0.5).
pcl::IndicesPtr source_indices_
A pointer to the vector of source point indices to use after sampling.
float segmentToSegmentDist(const pcl::Indices &base_indices, float(&ratio)[2])
Calculate intersection ratios and segment to segment distances of base diagonals.
float getScoreThreshold() const
int nr_threads_
Number of threads for parallelization (standard = 1).
virtual int validateMatch(const pcl::Indices &base_indices, const pcl::Indices &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...
IndicesPtr getTargetIndices() const
float max_norm_diff_
Maximum normal difference of corresponding point pairs in degrees (standard = 90).
int getMaxComputationTime() const
float fitness_score_
Resulting fitness score of the best match.
float diameter_
Estimated diameter of the target point cloud.
void setSourceNormals(const NormalsConstPtr &source_normals)
Provide a pointer to the normals of the source point cloud.
NormalsConstPtr getSourceNormals() const
NormalsConstPtr getTargetNormals() const
FPCSInitialAlignment()
Constructor.
float getMaxNormalDifference() const
void setMaxComputationTime(int max_runtime)
Set the maximum computation time in seconds.
void setTargetIndices(const IndicesPtr &target_indices)
Provide a pointer to the vector of target indices.
float getApproxOverlap() const
void setNumberOfThreads(int nr_threads)
Set the number of used threads if OpenMP is activated.
float max_pair_diff_
Maximal difference between corresponding point pairs in source and target.
void setApproxOverlap(float approx_overlap)
Set the approximate overlap between source and target.
~FPCSInitialAlignment() override=default
Destructor.
const float small_error_
Definition of a small error.
int max_runtime_
Maximum allowed computation time in seconds (standard = 0 => ~unlimited).
void computeTransformation(PointCloudSource &output, const Eigen::Matrix4f &guess) override
Rigid transformation computation method.
float score_threshold_
Score threshold to stop calculation with success.
void setDelta(float delta, bool normalize=false)
Set the constant factor delta which weights the internally calculated parameters.
virtual bool initCompute()
Internal computation initialization.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
shared_ptr< KdTree< PointT, Tree > > Ptr
Define standard C methods and C++ classes that are common to all methods.
std::vector< MatchingCandidate, Eigen::aligned_allocator< MatchingCandidate > > MatchingCandidates
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.
std::vector< pcl::Correspondence, Eigen::aligned_allocator< pcl::Correspondence > > Correspondences
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< Indices > IndicesPtr
#define PCL_DEPRECATED(Major, Minor, Message)
macro for compatibility across compilers and help remove old deprecated items for the Major....
A point structure representing normal coordinates and the surface curvature estimate.
Container for matching candidate consisting of.