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
c820438b
Commit
c820438b
authored
Apr 01, 2011
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restored several tests on features2d after moving on google tests
parent
253d8c68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
41 deletions
+95
-41
test_features2d.cpp
modules/features2d/test/test_features2d.cpp
+95
-41
No files found.
modules/features2d/test/test_features2d.cpp
View file @
c820438b
...
...
@@ -56,8 +56,8 @@ const string IMAGE_FILENAME = "tsukuba.png";
class
CV_FeatureDetectorTest
:
public
cvtest
::
BaseTest
{
public
:
CV_FeatureDetectorTest
(
const
Ptr
<
FeatureDetector
>&
_fdetector
)
:
fdetector
(
_fdetector
)
{}
CV_FeatureDetectorTest
(
const
string
&
_name
,
const
Ptr
<
FeatureDetector
>&
_fdetector
)
:
name
(
_name
),
fdetector
(
_fdetector
)
{}
protected
:
bool
isSimilarKeypoints
(
const
KeyPoint
&
p1
,
const
KeyPoint
&
p2
);
...
...
@@ -68,6 +68,7 @@ protected:
virtual
void
run
(
int
);
string
name
;
Ptr
<
FeatureDetector
>
fdetector
;
};
...
...
@@ -288,9 +289,9 @@ public:
typedef
typename
Distance
::
ValueType
ValueType
;
typedef
typename
Distance
::
ResultType
DistanceType
;
CV_DescriptorExtractorTest
(
DistanceType
_maxDist
,
const
Ptr
<
DescriptorExtractor
>&
_dextractor
,
float
_prevTime
,
CV_DescriptorExtractorTest
(
const
string
_name
,
DistanceType
_maxDist
,
const
Ptr
<
DescriptorExtractor
>&
_dextractor
,
float
_prevTime
,
Distance
d
=
Distance
()
)
:
maxDist
(
_maxDist
),
prevTime
(
_prevTime
),
dextractor
(
_dextractor
),
distance
(
d
)
{}
name
(
_name
),
maxDist
(
_maxDist
),
prevTime
(
_prevTime
),
dextractor
(
_dextractor
),
distance
(
d
)
{}
protected
:
virtual
void
createDescriptorExtractor
()
{}
...
...
@@ -476,6 +477,7 @@ protected:
const
DistanceType
maxDist
;
const
float
prevTime
;
string
name
;
Ptr
<
DescriptorExtractor
>
dextractor
;
Distance
distance
;
...
...
@@ -506,8 +508,8 @@ protected:
class
CV_DescriptorMatcherTest
:
public
cvtest
::
BaseTest
{
public
:
CV_DescriptorMatcherTest
(
const
Ptr
<
DescriptorMatcher
>&
_dmatcher
,
float
_badPart
)
:
badPart
(
_badPart
),
dmatcher
(
_dmatcher
)
CV_DescriptorMatcherTest
(
const
string
&
_name
,
const
Ptr
<
DescriptorMatcher
>&
_dmatcher
,
float
_badPart
)
:
name
(
_name
),
badPart
(
_badPart
),
dmatcher
(
_dmatcher
)
{}
protected
:
static
const
int
dim
=
500
;
...
...
@@ -523,7 +525,9 @@ protected:
void
knnMatchTest
(
const
Mat
&
query
,
const
Mat
&
train
);
void
radiusMatchTest
(
const
Mat
&
query
,
const
Mat
&
train
);
string
name
;
Ptr
<
DescriptorMatcher
>
dmatcher
;
private
:
CV_DescriptorMatcherTest
&
operator
=
(
const
CV_DescriptorMatcherTest
&
)
{
return
*
this
;
}
};
...
...
@@ -953,86 +957,136 @@ void CV_DescriptorMatcherTest::run( int )
* Tests registrations *
\****************************************************************************************/
/****************************************************************************************\
* Tests registrations *
\****************************************************************************************/
/*
* Detectors
* "detector-fast, detector-gftt, detector-harris, detector-mser, detector-sift, detector-star, detector-surf, detector-grid-fast, detector-pyramid-fast"
*/
/*CV_FeatureDetectorTest fastTest( "detector-fast", FeatureDetector::create("FAST") );
CV_FeatureDetectorTest gfttTest( "detector-gftt", FeatureDetector::create("GFTT") );
CV_FeatureDetectorTest harrisTest( "detector-harris", FeatureDetector::create("HARRIS") );
CV_FeatureDetectorTest mserTest( "detector-mser", FeatureDetector::create("MSER") );
CV_FeatureDetectorTest siftTest( "detector-sift", FeatureDetector::create("SIFT") );
CV_FeatureDetectorTest starTest( "detector-star", FeatureDetector::create("STAR") );
CV_FeatureDetectorTest surfTest( "detector-surf", FeatureDetector::create("SURF") );
CV_FeatureDetectorTest gridFastfTest( "detector-grid-fast", FeatureDetector::create("GridFAST") );
CV_FeatureDetectorTest pyramidFastTest( "detector-pyramid-fast", FeatureDetector::create("PyramidFAST") );*/
TEST
(
Features2d_Detector_FAST
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-fast"
,
FeatureDetector
::
create
(
"FAST"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_GFTT
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-gftt"
,
FeatureDetector
::
create
(
"GFTT"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_Harris
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-harris"
,
FeatureDetector
::
create
(
"HARRIS"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_MSER
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-mser"
,
FeatureDetector
::
create
(
"MSER"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_SIFT
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-sift"
,
FeatureDetector
::
create
(
"SIFT"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_STAR
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-star"
,
FeatureDetector
::
create
(
"STAR"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_SURF
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-surf"
,
FeatureDetector
::
create
(
"SURF"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_GridFAST
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-grid-fast"
,
FeatureDetector
::
create
(
"GridFAST"
)
);
test
.
safe_run
();
}
TEST
(
Features2d_Detector_PyramidFAST
,
regression
)
{
CV_FeatureDetectorTest
test
(
"detector-pyramid-fast"
,
FeatureDetector
::
create
(
"PyramidFAST"
)
);
test
.
safe_run
();
}
/*
* Descriptors
* "descriptor-sift, descriptor-surf, descriptor-calonder-uchar, descriptor-calonder-float, descriptor-brief, descriptor-opponent-sift, descriptor-opponent-surf"
*/
TEST
(
Features2d_Descriptor_SIFT
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_SIFT
,
regression
)
{
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
0.03
f
,
DescriptorExtractor
::
create
(
"SIFT"
),
8.06652
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
"descriptor-sift"
,
0.03
f
,
DescriptorExtractor
::
create
(
"SIFT"
),
8.06652
f
);
test
.
safe_run
();
}
TEST
(
Features2d_Descriptor_SURF
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_SURF
,
regression
)
{
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
0.035
f
,
DescriptorExtractor
::
create
(
"SURF"
),
0.147372
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
"descriptor-surf"
,
0.035
f
,
DescriptorExtractor
::
create
(
"SURF"
),
0.147372
f
);
test
.
safe_run
();
}
TEST
(
Features2d_Descriptor_BRIEF
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_BRIEF
,
regression
)
{
CV_DescriptorExtractorTest
<
Hamming
>
test
(
1
,
DescriptorExtractor
::
create
(
"BRIEF"
),
0.00527548
f
);
CV_DescriptorExtractorTest
<
Hamming
>
test
(
"descriptor-brief"
,
1
,
DescriptorExtractor
::
create
(
"BRIEF"
),
0.00527548
f
);
test
.
safe_run
();
}
TEST
(
Features2d_Descriptor_OpponentSIFT
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_OpponentSIFT
,
regression
)
{
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
0.18
f
,
DescriptorExtractor
::
create
(
"OpponentSIFT"
),
8.06652
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
"descriptor-opponent-sift"
,
0.18
f
,
DescriptorExtractor
::
create
(
"OpponentSIFT"
),
8.06652
f
);
test
.
safe_run
();
}
TEST
(
Features2d_Descriptor_OpponentSURF
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_OpponentSURF
,
regression
)
{
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
0.18
f
,
DescriptorExtractor
::
create
(
"OpponentSURF"
),
0.147372
f
);
CV_DescriptorExtractorTest
<
L2
<
float
>
>
test
(
"descriptor-opponent-surf"
,
0.18
f
,
DescriptorExtractor
::
create
(
"OpponentSURF"
),
0.147372
f
);
test
.
safe_run
();
}
#if CV_SSE2
TEST
(
Features2d_Descriptor_Calonder_uchar
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_Calonder_uchar
,
regression
)
{
CV_CalonderDescriptorExtractorTest
<
uchar
,
L2
<
uchar
>
>
test
(
std
::
numeric_limits
<
float
>::
epsilon
()
+
1
,
0.0132175
f
);
CV_CalonderDescriptorExtractorTest
<
uchar
,
L2
<
uchar
>
>
test
(
"descriptor-calonder-uchar"
,
std
::
numeric_limits
<
float
>::
epsilon
()
+
1
,
0.0132175
f
);
test
.
safe_run
();
}
TEST
(
Features2d_Descriptor_Calonder_float
,
regression
)
TEST
(
Features2d_Descriptor
Extractor
_Calonder_float
,
regression
)
{
CV_CalonderDescriptorExtractorTest
<
float
,
L2
<
float
>
>
test
(
std
::
numeric_limits
<
float
>::
epsilon
(),
0.0221308
f
);
CV_CalonderDescriptorExtractorTest
<
float
,
L2
<
float
>
>
test
(
"descriptor-calonder-float"
,
std
::
numeric_limits
<
float
>::
epsilon
(),
0.0221308
f
);
test
.
safe_run
();
}
#endif // CV_SSE2
/*
* Matchers
* "descriptor-matcher-brute-force, descriptor-matcher-flann-based"
*/
TEST
(
Features2d_DescriptorMatcher_BruteForce
_L2
,
accuracy
)
TEST
(
Features2d_DescriptorMatcher_BruteForce
,
regression
)
{
CV_DescriptorMatcherTest
test
(
new
BruteForceMatcher
<
L2
<
float
>
>
,
0.01
f
);
CV_DescriptorMatcherTest
test
(
"descriptor-matcher-brute-force"
,
new
BruteForceMatcher
<
L2
<
float
>
>
,
0.01
f
);
test
.
safe_run
();
}
TEST
(
Features2d_DescriptorMatcher_F
LANN
,
accuracy
)
TEST
(
Features2d_DescriptorMatcher_F
lannBased
,
regression
)
{
CV_DescriptorMatcherTest
test
(
new
FlannBasedMatcher
,
0.04
f
);
CV_DescriptorMatcherTest
test
(
"descriptor-matcher-flann-based"
,
new
FlannBasedMatcher
,
0.04
f
);
test
.
safe_run
();
}
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