modified DescriptorMatcher
This commit is contained in:
parent
454e346334
commit
48e4f66ccf
@ -1577,7 +1577,7 @@ protected:
|
|||||||
* The mask may be empty.
|
* The mask may be empty.
|
||||||
*/
|
*/
|
||||||
virtual void matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
virtual void matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
||||||
const Mat& mask, vector<int>& matches, vector<double>& distances ) const = 0;
|
const Mat& mask, vector<int>& matches ) const = 0;
|
||||||
|
|
||||||
static bool possibleMatch( const Mat& mask, int index_1, int index_2 )
|
static bool possibleMatch( const Mat& mask, int index_1, int index_2 )
|
||||||
{
|
{
|
||||||
@ -1605,15 +1605,13 @@ inline void DescriptorMatcher::add( const Mat& descriptors )
|
|||||||
|
|
||||||
inline void DescriptorMatcher::match( const Mat& query, vector<int>& matches ) const
|
inline void DescriptorMatcher::match( const Mat& query, vector<int>& matches ) const
|
||||||
{
|
{
|
||||||
vector<double> innDistances;
|
matchImpl( query, train, Mat(), matches );
|
||||||
matchImpl( query, train, Mat(), matches, innDistances );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DescriptorMatcher::match( const Mat& query, const Mat& mask,
|
inline void DescriptorMatcher::match( const Mat& query, const Mat& mask,
|
||||||
vector<int>& matches ) const
|
vector<int>& matches ) const
|
||||||
{
|
{
|
||||||
vector<double> innDistances;
|
matchImpl( query, train, mask, matches );
|
||||||
matchImpl( query, train, mask, matches, innDistances );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DescriptorMatcher::clear()
|
inline void DescriptorMatcher::clear()
|
||||||
@ -1638,15 +1636,14 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
virtual void matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
||||||
const Mat& mask, vector<int>& matches, vector<double>& distances) const;
|
const Mat& mask, vector<int>& matches ) const;
|
||||||
|
|
||||||
Distance distance;
|
Distance distance;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Distance>
|
template<class Distance>
|
||||||
void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat& descriptors_2,
|
||||||
const Mat& mask, vector<int>& matches,
|
const Mat& mask, vector<int>& matches ) const
|
||||||
vector<double>& distances) const
|
|
||||||
{
|
{
|
||||||
typedef typename Distance::ValueType ValueType;
|
typedef typename Distance::ValueType ValueType;
|
||||||
typedef typename Distance::ResultType DistanceType;
|
typedef typename Distance::ResultType DistanceType;
|
||||||
@ -1682,10 +1679,7 @@ void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( matchIndex != -1 )
|
if( matchIndex != -1 )
|
||||||
{
|
|
||||||
matches.push_back( matchIndex );
|
matches.push_back( matchIndex );
|
||||||
distances.push_back( matchDistance );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user