79 lines
3.9 KiB
C++
79 lines
3.9 KiB
C++
#ifndef DETECTIONANDMATCHING_HPP
|
|
#define DETECTIONANDMATCHING_HPP
|
|
|
|
/////////////////////////////////////////////////////////
|
|
/// \defgroup detectionandmatching Detection and Matching module
|
|
///
|
|
/// Contains all the functions to compute the keypoints and
|
|
/// match them on differents images
|
|
/////////////////////////////////////////////////////////
|
|
|
|
/////////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief prints readme
|
|
/////////////////////////////////////////////////////////
|
|
void readme();
|
|
|
|
/////////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief detects the keypoints on the two
|
|
/// inputs images with BRISK and matches the keypoints
|
|
/// \param img_1 first image
|
|
/// \param img_2 second image
|
|
/// \param masque_1 mask of img_1
|
|
/// \param masque_2 mask of img_2
|
|
/// \return a vector containing the matches (pair of Point)
|
|
/////////////////////////////////////////////////////////
|
|
std::vector<std::pair<cv::Point,cv::Point>> detectAndMatch(cv::Mat const& img_1, cv::Mat const& img_2, cv::Mat const& masque_1, cv::Mat const& masque_2);
|
|
|
|
/////////////////////////////////////////////////////////
|
|
/// \brief Resize the mask of an image
|
|
/// \param the mask to resize and the size of the image
|
|
/// \return the mask resized
|
|
/// \pre the original image need to be in landscape
|
|
////////////////////////////////////////////////////////
|
|
cv::Mat resizeMask(cv::Mat const& mask, cv::Size const& sizeImage);
|
|
|
|
/////////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief filter the matches in order to
|
|
/// keep the symmetric one
|
|
/// \param matches1 contains indexes of matched points : queryIdx for image1 and trainIdx for image 2
|
|
/// \param matches2 contains indexes of matched points : queryIdx for image2 and trainIdx for image 1
|
|
/// \return symetric matches
|
|
////////////////////////////////////////////////////////
|
|
std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > const& matches1, std::vector< cv::DMatch > const& matches2);
|
|
|
|
///////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief filter the matches in order to be ordered
|
|
/// \param symetricMatches matches that are filtered by the symetricFilter function
|
|
/// \param keypoints_1 keypoints of the first image
|
|
/// \param keypoints_2 keypoints of the second image
|
|
/// \param proportion
|
|
/// \return matches filtered with the order constraint
|
|
/// \see symetricFilter
|
|
////////////////////////////////////////////////////////
|
|
std::vector< cv::DMatch > orderConstraintFilter (std::vector< cv::DMatch > const& symetricMatches, std::vector<cv::KeyPoint> const& keypoints_1, std::vector<cv::KeyPoint> const& keypoints_2, float proportion);
|
|
|
|
////////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief add a constraint on the distance between descriptors
|
|
/// \param distanceThreshold maximum distance between two descriptors
|
|
/// \param matches matches to filter
|
|
/// \return matches filtered by distance between descriptors
|
|
/////////////////////////////////////////////////////////
|
|
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > const& matches);
|
|
|
|
////////////////////////////////////////////////////////
|
|
/// \ingroup detectionandmatching
|
|
/// \brief filter using epipolar geometry, and the fundamental matrix to filter strange points
|
|
/// \param keypoints_1 keypoints on the first image
|
|
/// \param keypoints_2 keypoints on the second image
|
|
/// \param correctedMatches the matches in input
|
|
/// \return matches filtered by geometric criteria
|
|
///////////////////////////////////////////////////////
|
|
std::tuple<std::vector<cv::DMatch>, std::vector<cv::KeyPoint>, std::vector<cv::KeyPoint>> geometricFilter ( std::vector<cv::KeyPoint> const& keypoints_1, std::vector<cv::KeyPoint> const& keypoints_2, std::vector< cv::DMatch > const& correctedMatches);
|
|
|
|
#endif // DETECTIONANDMATCHING_HPP
|