ajout de const dans detectAndMatching

This commit is contained in:
Amandinella 2015-03-11 17:06:12 +01:00
parent 9136293b0e
commit 542ee89780
3 changed files with 14 additions and 14 deletions

View File

@ -24,7 +24,7 @@ void readme();
/// \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 img_1, cv::Mat img_2, cv::Mat masque_1, cv::Mat masque_2);
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
@ -32,7 +32,7 @@ std::vector<std::pair<cv::Point, cv::Point>> DetectAndMatch(cv::Mat img_1, cv::M
/// \return the mask resized
/// \pre the original image need to be in landscape
////////////////////////////////////////////////////////
cv::Mat resizeMask(cv::Mat mask, cv::Size sizeImage);
cv::Mat resizeMask(cv::Mat const& mask, cv::Size const& sizeImage);
/////////////////////////////////////////////////////////
/// \ingroup detectionandmatching
@ -42,7 +42,7 @@ cv::Mat resizeMask(cv::Mat mask, cv::Size sizeImage);
/// \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 > matches1, std::vector< cv::DMatch > matches2);
std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > const& matches1, std::vector< cv::DMatch > const& matches2);
///////////////////////////////////////////////////////
/// \ingroup detectionandmatching
@ -54,7 +54,7 @@ std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > matches1, st
/// \return matches filtered with the order constraint
/// \see symetricFilter
////////////////////////////////////////////////////////
std::vector< cv::DMatch > orderConstraintFilter (std::vector< cv::DMatch > symetricMatches, std::vector<cv::KeyPoint> keypoints_1, std::vector<cv::KeyPoint> keypoints_2, float proportion);
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
@ -63,7 +63,7 @@ std::vector< cv::DMatch > orderConstraintFilter (std::vector< cv::DMatch > symet
/// \param matches matches to filter
/// \return matches filtered by distance between descriptors
/////////////////////////////////////////////////////////
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > matches);
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > const& matches);
////////////////////////////////////////////////////////
/// \ingroup detectionandmatching
@ -73,6 +73,6 @@ std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector<
/// \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> keypoints_1, std::vector<cv::KeyPoint> keypoints_2, std::vector< cv::DMatch > correctedMatches);
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

View File

@ -1,5 +1,5 @@
add_subdirectory(Calibration)
# add_subdirectory(DetectionAndMatching)
add_subdirectory(DetectionAndMatching)
add_subdirectory(Extern)
add_subdirectory(HelloCV)
add_subdirectory(Segmentation)

View File

@ -51,12 +51,12 @@ if( !img_1.data || !img_2.data )
std::vector<std::pair<cv::Point, cv::Point>> matchPoints;
cv::Mat masque_1_resize = resizeMask(masque_1,img_1.size());
cv::Mat masque_2_resize = resizeMask(masque_2,img_2.size());
matchPoints = DetectAndMatch(img_1, img_2, masque_1_resize, masque_2_resize);
matchPoints = detectAndMatch(img_1, img_2, masque_1_resize, masque_2_resize);
return 0;
}
std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Mat img_2, cv::Mat masque_1, cv::Mat masque_2)
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)
{
//-- Step 1: Detect the keypoints using BRISK Detector
@ -146,7 +146,7 @@ std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Ma
}
std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > matches1, std::vector< cv::DMatch > matches2)
std::vector< cv::DMatch > symetricFilter( std::vector< cv::DMatch > const& matches1, std::vector< cv::DMatch > const& matches2)
{
std::vector< cv::DMatch > symetricMatches;
unsigned int h;
@ -166,7 +166,7 @@ std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Ma
}
std::vector< cv::DMatch > orderConstraintFilter (std::vector< cv::DMatch > symetricMatches, std::vector<cv::KeyPoint> keypoints_1, std::vector<cv::KeyPoint> keypoints_2, float proportion)
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)
{
std::vector< cv::DMatch > matches;
unsigned int counter;
@ -188,7 +188,7 @@ std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Ma
return matches;
}
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > matches)
std::vector< cv::DMatch > thresholdFilter (float distanceThreshold, std::vector< cv::DMatch > const& matches)
{
std::vector< cv::DMatch > correctedMatches;
for(unsigned int i=0;i<matches.size();i++)
@ -200,7 +200,7 @@ std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Ma
}
std::tuple<std::vector<cv::DMatch>, std::vector<cv::KeyPoint>, std::vector<cv::KeyPoint>> geometricFilter ( std::vector<cv::KeyPoint> keypoints_1, std::vector<cv::KeyPoint> keypoints_2, std::vector< cv::DMatch > correctedMatches)
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)
{
std::vector< cv::DMatch > matches;
std::vector<cv::KeyPoint> kpoints_1, kpoints_2, newkpoints_1, newkpoints_2;
@ -229,7 +229,7 @@ std::vector<std::pair<cv::Point,cv::Point>> DetectAndMatch(cv::Mat img_1, cv::Ma
}
cv::Mat resizeMask(cv::Mat mask, cv::Size sizeImage)
cv::Mat resizeMask(cv::Mat const& mask, cv::Size const& sizeImage)
{
cv::Size sizeMask = mask.size();
cv::Mat newMask = cv::Mat::zeros(sizeImage, CV_8UC1);