paella/Code/include/DetectionAndMatching/DetectionAndMatching.hpp

79 lines
3.9 KiB
C++
Raw Normal View History

2015-02-13 11:12:23 +01:00
#ifndef DETECTIONANDMATCHING_HPP
#define DETECTIONANDMATCHING_HPP
2015-03-09 19:48:52 +01:00
/////////////////////////////////////////////////////////
/// \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
/////////////////////////////////////////////////////////
2015-02-13 11:12:23 +01:00
void readme();
2015-03-02 11:50:02 +01:00
/////////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \ingroup detectionandmatching
/// \brief detects the keypoints on the two
2015-03-11 16:51:20 +01:00
/// inputs images with BRISK and matches the keypoints
2015-03-09 15:38:19 +01:00
/// \param img_1 first image
/// \param img_2 second image
2015-03-09 19:48:52 +01:00
/// \param masque_1 mask of img_1
/// \param masque_2 mask of img_2
2015-03-11 13:40:01 +01:00
/// \return a vector containing the matches (pair of Point)
2015-03-02 11:50:02 +01:00
/////////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
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);
2015-02-13 11:12:23 +01:00
2015-03-02 11:50:02 +01:00
/////////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \brief Resize the mask of an image
2015-03-02 11:50:02 +01:00
/// \param the mask to resize and the size of the image
2015-03-11 13:40:01 +01:00
/// \return the mask resized
2015-03-09 19:48:52 +01:00
/// \pre the original image need to be in landscape
2015-03-02 11:50:02 +01:00
////////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
cv::Mat resizeMask(cv::Mat const& mask, cv::Size const& sizeImage);
2015-02-13 11:12:23 +01:00
2015-03-02 11:50:02 +01:00
/////////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \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
2015-03-11 13:40:01 +01:00
/// \return symetric matches
2015-03-02 11:50:02 +01:00
////////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > const& matches1, std::vector< cv::DMatch > const& matches2);
2015-02-13 11:12:23 +01:00
2015-03-02 11:50:02 +01:00
///////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \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
2015-03-11 13:40:01 +01:00
/// \return matches filtered with the order constraint
2015-03-09 19:48:52 +01:00
/// \see symetricFilter
2015-03-02 11:50:02 +01:00
////////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
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);
2015-02-13 11:12:23 +01:00
2015-03-02 11:50:02 +01:00
////////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \ingroup detectionandmatching
/// \brief add a constraint on the distance between descriptors
/// \param distanceThreshold maximum distance between two descriptors
/// \param matches matches to filter
2015-03-11 13:40:01 +01:00
/// \return matches filtered by distance between descriptors
2015-03-02 11:50:02 +01:00
/////////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > const& matches);
2015-02-13 11:12:23 +01:00
2015-03-02 11:50:02 +01:00
////////////////////////////////////////////////////////
2015-03-09 19:48:52 +01:00
/// \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
2015-03-09 15:38:19 +01:00
/// \param correctedMatches the matches in input
2015-03-11 13:40:01 +01:00
/// \return matches filtered by geometric criteria
2015-03-02 11:50:02 +01:00
///////////////////////////////////////////////////////
2015-03-11 17:06:12 +01:00
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);
2015-02-13 11:12:23 +01:00
#endif // DETECTIONANDMATCHING_HPP