Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c6a943b6
Commit
c6a943b6
authored
Jun 11, 2010
by
Victor Erukhimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DescriptorMatching -> DMatch
parent
c6750a0f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
25 deletions
+25
-25
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+16
-16
descriptors.cpp
modules/features2d/src/descriptors.cpp
+4
-4
adetectordescriptor_evaluation.cpp
tests/cv/src/adetectordescriptor_evaluation.cpp
+5
-5
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
c6a943b6
...
@@ -1508,18 +1508,18 @@ struct CV_EXPORTS L2
...
@@ -1508,18 +1508,18 @@ struct CV_EXPORTS L2
/****************************************************************************************\
/****************************************************************************************\
* D
escriptorMatching
*
* D
Match
*
\****************************************************************************************/
\****************************************************************************************/
/*
/*
* Struct for matching: match index and distance between descriptors
* Struct for matching: match index and distance between descriptors
*/
*/
struct
D
escriptorMatching
struct
D
Match
{
{
int
index
;
int
index
;
float
distance
;
float
distance
;
//less is better
//less is better
bool
operator
<
(
const
D
escriptorMatching
&
m
)
const
bool
operator
<
(
const
D
Match
&
m
)
const
{
{
return
distance
<
m
.
distance
;
return
distance
<
m
.
distance
;
}
}
...
@@ -1573,7 +1573,7 @@ public:
...
@@ -1573,7 +1573,7 @@ public:
* query The query set of descriptors
* query The query set of descriptors
* matchings Matchings of the closest matches from the training set
* matchings Matchings of the closest matches from the training set
*/
*/
void
match
(
const
Mat
&
query
,
vector
<
D
escriptorMatching
>&
matchings
)
const
;
void
match
(
const
Mat
&
query
,
vector
<
D
Match
>&
matchings
)
const
;
/*
/*
* Find the best matches between two descriptor sets, with constraints
* Find the best matches between two descriptor sets, with constraints
...
@@ -1587,7 +1587,7 @@ public:
...
@@ -1587,7 +1587,7 @@ public:
* matchings Matchings of the closest matches from the training set
* matchings Matchings of the closest matches from the training set
*/
*/
void
match
(
const
Mat
&
query
,
const
Mat
&
mask
,
void
match
(
const
Mat
&
query
,
const
Mat
&
mask
,
vector
<
D
escriptorMatching
>&
matchings
)
const
;
vector
<
D
Match
>&
matchings
)
const
;
/*
/*
* Find the best keypoint matches for small view changes.
* Find the best keypoint matches for small view changes.
...
@@ -1623,7 +1623,7 @@ protected:
...
@@ -1623,7 +1623,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
<
D
escriptorMatching
>&
matches
)
const
=
0
;
const
Mat
&
mask
,
vector
<
D
Match
>&
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
)
{
{
...
@@ -1660,14 +1660,14 @@ inline void DescriptorMatcher::match( const Mat& query, const Mat& mask,
...
@@ -1660,14 +1660,14 @@ inline void DescriptorMatcher::match( const Mat& query, const Mat& mask,
matchImpl
(
query
,
train
,
mask
,
matches
);
matchImpl
(
query
,
train
,
mask
,
matches
);
}
}
inline
void
DescriptorMatcher
::
match
(
const
Mat
&
query
,
vector
<
D
escriptorMatching
>&
matches
)
const
inline
void
DescriptorMatcher
::
match
(
const
Mat
&
query
,
vector
<
D
Match
>&
matches
)
const
{
{
matchImpl
(
query
,
train
,
Mat
(),
matches
);
matchImpl
(
query
,
train
,
Mat
(),
matches
);
}
}
inline
void
DescriptorMatcher
::
match
(
const
Mat
&
query
,
const
Mat
&
mask
,
inline
void
DescriptorMatcher
::
match
(
const
Mat
&
query
,
const
Mat
&
mask
,
vector
<
D
escriptorMatching
>&
matches
)
const
vector
<
D
Match
>&
matches
)
const
{
{
matchImpl
(
query
,
train
,
mask
,
matches
);
matchImpl
(
query
,
train
,
mask
,
matches
);
}
}
...
@@ -1697,7 +1697,7 @@ protected:
...
@@ -1697,7 +1697,7 @@ protected:
const
Mat
&
mask
,
vector
<
int
>&
matches
)
const
;
const
Mat
&
mask
,
vector
<
int
>&
matches
)
const
;
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
<
D
escriptorMatching
>&
matches
)
const
;
const
Mat
&
mask
,
vector
<
D
Match
>&
matches
)
const
;
Distance
distance
;
Distance
distance
;
};
};
...
@@ -1706,7 +1706,7 @@ template<class Distance>
...
@@ -1706,7 +1706,7 @@ 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
const
Mat
&
mask
,
vector
<
int
>&
matches
)
const
{
{
vector
<
D
escriptorMatching
>
matchings
;
vector
<
D
Match
>
matchings
;
matchImpl
(
descriptors_1
,
descriptors_2
,
mask
,
matchings
);
matchImpl
(
descriptors_1
,
descriptors_2
,
mask
,
matchings
);
matches
.
resize
(
matchings
.
size
()
);
matches
.
resize
(
matchings
.
size
()
);
for
(
size_t
i
=
0
;
i
<
matchings
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
matchings
.
size
();
i
++
)
...
@@ -1717,7 +1717,7 @@ void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat
...
@@ -1717,7 +1717,7 @@ void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat
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
<
D
escriptorMatching
>&
matches
)
const
const
Mat
&
mask
,
vector
<
D
Match
>&
matches
)
const
{
{
typedef
typename
Distance
::
ValueType
ValueType
;
typedef
typename
Distance
::
ValueType
ValueType
;
typedef
typename
Distance
::
ResultType
DistanceType
;
typedef
typename
Distance
::
ResultType
DistanceType
;
...
@@ -1753,7 +1753,7 @@ void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat
...
@@ -1753,7 +1753,7 @@ void BruteForceMatcher<Distance>::matchImpl( const Mat& descriptors_1, const Mat
if
(
matchIndex
!=
-
1
)
if
(
matchIndex
!=
-
1
)
{
{
D
escriptorMatching
matching
;
D
Match
matching
;
matching
.
index
=
matchIndex
;
matching
.
index
=
matchIndex
;
matching
.
distance
=
matchDistance
;
matching
.
distance
=
matchDistance
;
matches
[
i
]
=
matching
;
matches
[
i
]
=
matching
;
...
@@ -1830,7 +1830,7 @@ public:
...
@@ -1830,7 +1830,7 @@ public:
// image The source image
// image The source image
// points Test keypoints from the source image
// points Test keypoints from the source image
// matchings A vector to be filled with keypoint matchings
// matchings A vector to be filled with keypoint matchings
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
escriptorMatching
>&
matchings
)
{};
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
Match
>&
matchings
)
{};
// Clears keypoints storing in collection
// Clears keypoints storing in collection
virtual
void
clear
();
virtual
void
clear
();
...
@@ -1906,7 +1906,7 @@ public:
...
@@ -1906,7 +1906,7 @@ public:
// loaded with DescriptorOneWay::Initialize, kd tree is used for finding minimum distances.
// loaded with DescriptorOneWay::Initialize, kd tree is used for finding minimum distances.
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
int
>&
indices
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
int
>&
indices
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
escriptorMatching
>&
matchings
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
Match
>&
matchings
);
// Classify a set of keypoints. The same as match, but returns point classes rather than indices
// Classify a set of keypoints. The same as match, but returns point classes rather than indices
virtual
void
classify
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
);
virtual
void
classify
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
);
...
@@ -2036,7 +2036,7 @@ public:
...
@@ -2036,7 +2036,7 @@ public:
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
vector
<
int
>&
indices
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
vector
<
int
>&
indices
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
escriptorMatching
>&
matchings
);
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
Match
>&
matchings
);
virtual
void
classify
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
);
virtual
void
classify
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
);
...
@@ -2094,7 +2094,7 @@ public:
...
@@ -2094,7 +2094,7 @@ public:
matcher
.
match
(
descriptors
,
keypointIndices
);
matcher
.
match
(
descriptors
,
keypointIndices
);
};
};
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
escriptorMatching
>&
matchings
)
virtual
void
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
Match
>&
matchings
)
{
{
Mat
descriptors
;
Mat
descriptors
;
extractor
.
compute
(
image
,
points
,
descriptors
);
extractor
.
compute
(
image
,
points
,
descriptors
);
...
...
modules/features2d/src/descriptors.cpp
View file @
c6a943b6
...
@@ -433,7 +433,7 @@ void OneWayDescriptorMatch::add( KeyPointCollection& keypoints )
...
@@ -433,7 +433,7 @@ void OneWayDescriptorMatch::add( KeyPointCollection& keypoints )
void
OneWayDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
int
>&
indices
)
void
OneWayDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
int
>&
indices
)
{
{
vector
<
D
escriptorMatching
>
matchings
(
points
.
size
()
);
vector
<
D
Match
>
matchings
(
points
.
size
()
);
indices
.
resize
(
points
.
size
());
indices
.
resize
(
points
.
size
());
match
(
image
,
points
,
matchings
);
match
(
image
,
points
,
matchings
);
...
@@ -442,7 +442,7 @@ void OneWayDescriptorMatch::match( const Mat& image, vector<KeyPoint>& points, v
...
@@ -442,7 +442,7 @@ void OneWayDescriptorMatch::match( const Mat& image, vector<KeyPoint>& points, v
indices
[
i
]
=
matchings
[
i
].
index
;
indices
[
i
]
=
matchings
[
i
].
index
;
}
}
void
OneWayDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
escriptorMatching
>&
matchings
)
void
OneWayDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
points
,
vector
<
D
Match
>&
matchings
)
{
{
matchings
.
resize
(
points
.
size
()
);
matchings
.
resize
(
points
.
size
()
);
IplImage
_image
=
image
;
IplImage
_image
=
image
;
...
@@ -450,7 +450,7 @@ void OneWayDescriptorMatch::match( const Mat& image, vector<KeyPoint>& points, v
...
@@ -450,7 +450,7 @@ void OneWayDescriptorMatch::match( const Mat& image, vector<KeyPoint>& points, v
{
{
int
poseIdx
=
-
1
;
int
poseIdx
=
-
1
;
D
escriptorMatching
matching
;
D
Match
matching
;
matching
.
index
=
-
1
;
matching
.
index
=
-
1
;
base
->
FindDescriptor
(
&
_image
,
points
[
i
].
pt
,
matching
.
index
,
poseIdx
,
matching
.
distance
);
base
->
FindDescriptor
(
&
_image
,
points
[
i
].
pt
,
matching
.
index
,
poseIdx
,
matching
.
distance
);
matchings
[
i
]
=
matching
;
matchings
[
i
]
=
matching
;
...
@@ -744,7 +744,7 @@ void FernDescriptorMatch::match( const Mat& image, vector<KeyPoint>& keypoints,
...
@@ -744,7 +744,7 @@ void FernDescriptorMatch::match( const Mat& image, vector<KeyPoint>& keypoints,
}
}
}
}
void
FernDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
vector
<
D
escriptorMatching
>&
matchings
)
void
FernDescriptorMatch
::
match
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
vector
<
D
Match
>&
matchings
)
{
{
trainFernClassifier
();
trainFernClassifier
();
...
...
tests/cv/src/adetectordescriptor_evaluation.cpp
View file @
c6a943b6
...
@@ -425,7 +425,7 @@ inline float precision( int correctMatchCount, int falseMatchCount )
...
@@ -425,7 +425,7 @@ inline float precision( int correctMatchCount, int falseMatchCount )
}
}
void
evaluateDescriptors
(
const
vector
<
EllipticKeyPoint
>&
keypoints1
,
const
vector
<
EllipticKeyPoint
>&
keypoints2
,
void
evaluateDescriptors
(
const
vector
<
EllipticKeyPoint
>&
keypoints1
,
const
vector
<
EllipticKeyPoint
>&
keypoints2
,
vector
<
pair
<
D
escriptorMatching
,
int
>
>&
matches1to2
,
vector
<
pair
<
D
Match
,
int
>
>&
matches1to2
,
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
H1to2
,
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
H1to2
,
int
&
correctMatchCount
,
int
&
falseMatchCount
,
vector
<
int
>
&
matchStatuses
,
int
&
correspondenceCount
)
int
&
correctMatchCount
,
int
&
falseMatchCount
,
vector
<
int
>
&
matchStatuses
,
int
&
correspondenceCount
)
{
{
...
@@ -1385,7 +1385,7 @@ void DescriptorQualityTest::runDatasetTest (const vector<Mat> &imgs, const vecto
...
@@ -1385,7 +1385,7 @@ void DescriptorQualityTest::runDatasetTest (const vector<Mat> &imgs, const vecto
transformToEllipticKeyPoints
(
keypoints1
,
ekeypoints1
);
transformToEllipticKeyPoints
(
keypoints1
,
ekeypoints1
);
int
progressCount
=
DATASETS_COUNT
*
TEST_CASE_COUNT
;
int
progressCount
=
DATASETS_COUNT
*
TEST_CASE_COUNT
;
vector
<
pair
<
D
escriptorMatching
,
int
>
>
allMatchings
;
vector
<
pair
<
D
Match
,
int
>
>
allMatchings
;
vector
<
int
>
allMatchStatuses
;
vector
<
int
>
allMatchStatuses
;
size_t
matchingIndex
=
0
;
size_t
matchingIndex
=
0
;
int
allCorrespCount
=
0
;
int
allCorrespCount
=
0
;
...
@@ -1405,11 +1405,11 @@ void DescriptorQualityTest::runDatasetTest (const vector<Mat> &imgs, const vecto
...
@@ -1405,11 +1405,11 @@ void DescriptorQualityTest::runDatasetTest (const vector<Mat> &imgs, const vecto
readKeypoints
(
keypontsFS
,
keypoints2
,
ci
+
1
);
readKeypoints
(
keypontsFS
,
keypoints2
,
ci
+
1
);
transformToEllipticKeyPoints
(
keypoints2
,
ekeypoints2
);
transformToEllipticKeyPoints
(
keypoints2
,
ekeypoints2
);
descMatch
->
add
(
imgs
[
ci
+
1
],
keypoints2
);
descMatch
->
add
(
imgs
[
ci
+
1
],
keypoints2
);
vector
<
D
escriptorMatching
>
matchings1to2
;
vector
<
D
Match
>
matchings1to2
;
descMatch
->
match
(
imgs
[
0
],
keypoints1
,
matchings1to2
);
descMatch
->
match
(
imgs
[
0
],
keypoints1
,
matchings1to2
);
vector
<
pair
<
D
escriptorMatching
,
int
>
>
matchings
(
matchings1to2
.
size
());
vector
<
pair
<
D
Match
,
int
>
>
matchings
(
matchings1to2
.
size
());
for
(
size_t
i
=
0
;
i
<
matchings1to2
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
matchings1to2
.
size
();
i
++
)
matchings
[
i
]
=
pair
<
D
escriptorMatching
,
int
>
(
matchings1to2
[
i
],
i
);
matchings
[
i
]
=
pair
<
D
Match
,
int
>
(
matchings1to2
[
i
],
i
);
// TODO if( commRunParams[di].matchFilter )
// TODO if( commRunParams[di].matchFilter )
int
correspCount
;
int
correspCount
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment