match_points_vw.h

Back to Conformal-affine point-pattern matching

pastel/geometry/pattern_matching/

// Description: Point-pattern matching between point-sets

#ifndef PASTELGEOMETRY_MATCH_POINTS_VW_H
#define PASTELGEOMETRY_MATCH_POINTS_VW_H

#include "pastel/sys/tuple.h"

#include "pastel/geometry/pointkdtree/pointkdtree.h"
#include "pastel/geometry/shape/sphere.h"

#include "pastel/math/conformalaffine2d/conformalaffine2d.h"

namespace Pastel
{

    template <
        typename Real, integer N, 
        typename Point_ConstRange, 
        typename Locator>
    Sphere<typename Locator::Real, Locator::N> 
        relativeMatchingDistance(
        const Point_ConstRange& pointSet,
        const Locator& locator);

    //! Finds a given model point pattern from the scene point pattern.
    /*!
   Preconditions:
   0 <= minMatchRatio <= 1
   relativeMatchingDistance >= 0

   This function searches for such a similarity transformation that 
   'minMatchRatio'-ratio of the mapped model points have a unique scene 
   point in their t-neighborhood. The 't' is computed by
   t = relativeMatchingDistance * sceneSphere.radius() / (2 * sqrt(scenePoints)).
   */
    template <
        typename Scene_Settings, template <typename> class Scene_Customization,
        typename Model_Settings, template <typename> class Model_Customization,
        typename Real = typename Scene_Settings::Real>
    bool pointPatternMatchVw(
        const PointKdTree<Scene_Settings, Scene_Customization>& sceneTree,
        const PointKdTree<Model_Settings, Model_Customization>& modelTree,
        const NoDeduction<Real>& minMatchRatio,
        const NoDeduction<Real>& relativeMatchingDistance,
        const NoDeduction<Real>& confidence,
        ConformalAffine2D<Real>& similarityResult);

    //! Finds the given model point pattern from the scene point pattern.
    /*!
   This is a convenience function which builds kd-trees from the point sets 
   and calls the more general 'pointPatternMatchVw()'.
   */

    template <
        typename Real, typename SceneRange, typename ModelRange,
        typename Scene_Locator,
        typename Model_Locator>
    bool pointPatternMatchVw(
        const SceneRange& scene,
        const ModelRange& model,
        const NoDeduction<Real>& minMatchRatio,
        const NoDeduction<Real>& relativeMatchingDistance,
        const NoDeduction<Real>& confidence,
        ConformalAffine2D<Real>& similarityResult,
        const Scene_Locator& sceneLocator,
        const Model_Locator& modelLocator);

    //! Finds the given model point pattern from the scene point pattern.
    /*!
   This is a convenience function which calls:
   pointPatternMatchVw(
       scene, model,
       minMatchRatio, 
       relativeMatchingDistance,
       confidence,
       similarityResult,
       Vector_Locator<Real, N>(),
       Vector_Locator<Real, N>());
   */

    template <typename Real, typename SceneRange, typename ModelRange>
    bool pointPatternMatchVw(
        const SceneRange& scene,
        const ModelRange& model,
        const NoDeduction<Real>& minMatchRatio,
        const NoDeduction<Real>& relativeMatchingDistance,
        const NoDeduction<Real>& confidence,
        ConformalAffine2D<Real>& similarityResult);

}

#include "pastel/geometry/pattern_matching/match_points_vw.hpp"

#endif