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
bb870a82
Commit
bb870a82
authored
Apr 09, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: fixing more tests
parent
2e7a9041
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
74 deletions
+72
-74
FASTFeatureDetectorTest.java
...c/org/opencv/test/features2d/FASTFeatureDetectorTest.java
+13
-14
FlannBasedDescriptorMatcherTest.java
...encv/test/features2d/FlannBasedDescriptorMatcherTest.java
+20
-18
ORBDescriptorExtractorTest.java
...rg/opencv/test/features2d/ORBDescriptorExtractorTest.java
+3
-5
SIFTDescriptorExtractorTest.java
...g/opencv/test/features2d/SIFTDescriptorExtractorTest.java
+3
-5
STARFeatureDetectorTest.java
...c/org/opencv/test/features2d/STARFeatureDetectorTest.java
+10
-11
SURFDescriptorExtractorTest.java
...g/opencv/test/features2d/SURFDescriptorExtractorTest.java
+2
-4
SURFFeatureDetectorTest.java
...c/org/opencv/test/features2d/SURFFeatureDetectorTest.java
+21
-17
No files found.
modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java
View file @
bb870a82
package
org
.
opencv
.
test
.
features2d
;
import
java.util.Arrays
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
...
...
@@ -10,10 +13,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
FASTFeatureDetectorTest
extends
OpenCVTestCase
{
FeatureDetector
detector
;
...
...
@@ -56,11 +55,11 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
public
void
testDetectMatListOfKeyPoint
()
{
Mat
img
=
getTestImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
keypoints
,
EPS
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
keypoints
.
toList
()
,
EPS
);
// OpenCVTestRunner.Log("points found: " + keypoints.size());
// for (KeyPoint kp : keypoints)
...
...
@@ -70,11 +69,11 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
public
void
testDetectMatListOfKeyPointMat
()
{
Mat
img
=
getTestImg
();
Mat
mask
=
getMaskImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints
,
mask
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
1
]),
keypoints
,
EPS
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
1
]),
keypoints
.
toList
()
,
EPS
);
}
public
void
testEmpty
()
{
...
...
@@ -87,18 +86,18 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
writeFile
(
filename
,
"%YAML:1.0\nthreshold: 130\nnonmaxSuppression: 1\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints1
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints1
=
new
MatOfKeyPoint
();
detector
.
detect
(
grayChess
,
keypoints1
);
writeFile
(
filename
,
"%YAML:1.0\nthreshold: 150\nnonmaxSuppression: 1\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints2
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints2
=
new
MatOfKeyPoint
();
detector
.
detect
(
grayChess
,
keypoints2
);
assertTrue
(
keypoints2
.
size
()
<=
keypoints1
.
size
());
assertTrue
(
keypoints2
.
total
()
<=
keypoints1
.
total
());
}
public
void
testReadYml
()
{
...
...
@@ -108,7 +107,7 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
"<?xml version=\"1.0\"?>\n<opencv_storage>\n<threshold>130</threshold>\n<nonmaxSuppression>1</nonmaxSuppression>\n</opencv_storage>\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints1
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints1
=
new
MatOfKeyPoint
();
detector
.
detect
(
grayChess
,
keypoints1
);
...
...
@@ -116,11 +115,11 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
"<?xml version=\"1.0\"?>\n<opencv_storage>\n<threshold>150</threshold>\n<nonmaxSuppression>1</nonmaxSuppression>\n</opencv_storage>\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints2
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints2
=
new
MatOfKeyPoint
();
detector
.
detect
(
grayChess
,
keypoints2
);
assertTrue
(
keypoints2
.
size
()
<=
keypoints1
.
size
());
assertTrue
(
keypoints2
.
total
()
<=
keypoints1
.
total
());
}
public
void
testWrite
()
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
View file @
bb870a82
package
org
.
opencv
.
test
.
features2d
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvException
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfDMatch
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DMatch
;
...
...
@@ -14,10 +19,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
FlannBasedDescriptorMatcherTest
extends
OpenCVTestCase
{
static
final
String
xmlParamsDefault
=
"<?xml version=\"1.0\"?>\n"
...
...
@@ -109,7 +110,7 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
}
private
Mat
getBriefTestDescriptors
(
Mat
img
)
{
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
Mat
descriptors
=
new
Mat
();
FeatureDetector
detector
=
FeatureDetector
.
create
(
FeatureDetector
.
FAST
);
...
...
@@ -141,7 +142,7 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
private
Mat
getQueryDescriptors
()
{
Mat
img
=
getQueryImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
Mat
descriptors
=
new
Mat
();
FeatureDetector
detector
=
FeatureDetector
.
create
(
FeatureDetector
.
SURF
);
...
...
@@ -167,7 +168,7 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
private
Mat
getTrainDescriptors
()
{
Mat
img
=
getTrainImg
();
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
new
KeyPoint
(
50
,
50
,
16
,
0
,
20000
,
1
,
-
1
),
new
KeyPoint
(
42
,
42
,
16
,
160
,
10000
,
1
,
-
1
));
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
new
KeyPoint
(
50
,
50
,
16
,
0
,
20000
,
1
,
-
1
),
new
KeyPoint
(
42
,
42
,
16
,
160
,
10000
,
1
,
-
1
));
Mat
descriptors
=
new
Mat
();
DescriptorExtractor
extractor
=
DescriptorExtractor
.
create
(
DescriptorExtractor
.
SURF
);
...
...
@@ -283,36 +284,36 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
public
void
testMatchMatListOfDMatch
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
train
();
matcher
.
match
(
query
,
matches
);
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
truth
,
matches
.
toArray
()
,
EPS
);
}
public
void
testMatchMatListOfDMatchListOfMat
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
Mat
mask
=
getMaskImg
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
train
();
matcher
.
match
(
query
,
matches
,
Arrays
.
asList
(
mask
));
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
truth
,
matches
.
toArray
()
,
EPS
);
}
public
void
testMatchMatMatListOfDMatch
()
{
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
match
(
query
,
train
,
matches
);
assert
ListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assert
ArrayDMatchEquals
(
truth
,
matches
.
toArray
()
,
EPS
);
// OpenCVTestRunner.Log("matches found: " + matches.size());
// for (DMatch m : matches)
...
...
@@ -323,11 +324,11 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
Mat
mask
=
getMaskImg
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
match
(
query
,
train
,
matches
,
mask
);
assertListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
,
EPS
);
assertListDMatchEquals
(
Arrays
.
asList
(
truth
),
matches
.
toList
()
,
EPS
);
}
public
void
testRadiusMatchMatListOfListOfDMatchFloat
()
{
...
...
@@ -362,14 +363,15 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
Mat
train
=
getBriefTrainDescriptors
();
Mat
query
=
getBriefQueryDescriptors
();
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
match
(
query
,
train
,
matches
);
assertListDMatchEquals
(
Arrays
.
asList
(
new
DMatch
(
0
,
0
,
0
,
0
),
assertArrayDMatchEquals
(
new
DMatch
[]{
new
DMatch
(
0
,
0
,
0
,
0
),
new
DMatch
(
1
,
2
,
0
,
0
),
new
DMatch
(
2
,
1
,
0
,
0
),
new
DMatch
(
3
,
3
,
0
,
0
)
),
matches
,
EPS
);
new
DMatch
(
3
,
3
,
0
,
0
)
},
matches
.
toArray
()
,
EPS
);
}
public
void
testTrain
()
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/ORBDescriptorExtractorTest.java
View file @
bb870a82
...
...
@@ -3,6 +3,7 @@ package org.opencv.test.features2d;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
...
...
@@ -10,9 +11,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
ORBDescriptorExtractorTest
extends
OpenCVTestCase
{
DescriptorExtractor
extractor
;
...
...
@@ -40,7 +38,7 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
public
void
testComputeMatListOfKeyPointMat
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
point
);
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
@@ -73,7 +71,7 @@ public class ORBDescriptorExtractorTest extends OpenCVTestCase {
public
void
testRead
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
point
);
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
modules/java/android_test/src/org/opencv/test/features2d/SIFTDescriptorExtractorTest.java
View file @
bb870a82
...
...
@@ -3,6 +3,7 @@ package org.opencv.test.features2d;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
...
...
@@ -10,9 +11,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
SIFTDescriptorExtractorTest
extends
OpenCVTestCase
{
DescriptorExtractor
extractor
;
...
...
@@ -50,7 +48,7 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
}
public
void
testComputeMatListOfKeyPointMat
()
{
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
keypoint
);
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
keypoint
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
@@ -76,7 +74,7 @@ public class SIFTDescriptorExtractorTest extends OpenCVTestCase {
}
public
void
testRead
()
{
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
keypoint
);
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
keypoint
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
modules/java/android_test/src/org/opencv/test/features2d/STARFeatureDetectorTest.java
View file @
bb870a82
package
org
.
opencv
.
test
.
features2d
;
import
java.util.Arrays
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
...
...
@@ -10,10 +13,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
STARFeatureDetectorTest
extends
OpenCVTestCase
{
FeatureDetector
detector
;
...
...
@@ -75,21 +74,21 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
public
void
testDetectMatListOfKeyPoint
()
{
Mat
img
=
getTestImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
keypoints
,
EPS
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
keypoints
.
toList
()
,
EPS
);
}
public
void
testDetectMatListOfKeyPointMat
()
{
Mat
img
=
getTestImg
();
Mat
mask
=
getMaskImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints
,
mask
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
2
],
truth
[
5
],
truth
[
7
]),
keypoints
,
EPS
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
0
],
truth
[
2
],
truth
[
5
],
truth
[
7
]),
keypoints
.
toList
()
,
EPS
);
}
public
void
testEmpty
()
{
...
...
@@ -99,17 +98,17 @@ public class STARFeatureDetectorTest extends OpenCVTestCase {
public
void
testRead
()
{
Mat
img
=
getTestImg
();
List
<
KeyPoint
>
keypoints1
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints1
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints1
);
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filename
,
"%YAML:1.0\nmaxSize: 45\nresponseThreshold: 150\nlineThresholdProjected: 10\nlineThresholdBinarized: 8\nsuppressNonmaxSize: 5\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints2
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints2
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints2
);
assertTrue
(
keypoints2
.
size
()
<=
keypoints1
.
size
());
assertTrue
(
keypoints2
.
total
()
<=
keypoints1
.
total
());
}
public
void
testWrite
()
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
View file @
bb870a82
...
...
@@ -3,6 +3,7 @@ package org.opencv.test.features2d;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.DescriptorExtractor
;
...
...
@@ -10,9 +11,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
SURFDescriptorExtractorTest
extends
OpenCVTestCase
{
DescriptorExtractor
extractor
;
...
...
@@ -40,7 +38,7 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
public
void
testComputeMatListOfKeyPointMat
()
{
KeyPoint
point
=
new
KeyPoint
(
55.775577545166016f
,
44.224422454833984f
,
16
,
9.754629f
,
8617.863f
,
1
,
-
1
);
List
<
KeyPoint
>
keypoints
=
Arrays
.
asLis
t
(
point
);
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoin
t
(
point
);
Mat
img
=
getTestImg
();
Mat
descriptors
=
new
Mat
();
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFFeatureDetectorTest.java
View file @
bb870a82
package
org
.
opencv
.
test
.
features2d
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfKeyPoint
;
import
org.opencv.core.Point
;
import
org.opencv.core.Scalar
;
import
org.opencv.features2d.FeatureDetector
;
...
...
@@ -10,12 +17,6 @@ import org.opencv.features2d.KeyPoint;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
public
class
SURFFeatureDetectorTest
extends
OpenCVTestCase
{
FeatureDetector
detector
;
...
...
@@ -72,7 +73,7 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
writeFile
(
filename
,
"%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
);
detector
.
read
(
filename
);
List
<
List
<
KeyPoint
>>
keypoints
=
new
ArrayList
<
List
<
KeyPoint
>
>();
List
<
MatOfKeyPoint
>
keypoints
=
new
ArrayList
<
MatOfKeyPoint
>();
Mat
cross
=
getTestImg
();
List
<
Mat
>
crosses
=
new
ArrayList
<
Mat
>(
3
);
crosses
.
add
(
cross
);
...
...
@@ -83,7 +84,8 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
assertEquals
(
3
,
keypoints
.
size
());
for
(
List
<
KeyPoint
>
lkp
:
keypoints
)
{
for
(
MatOfKeyPoint
mkp
:
keypoints
)
{
List
<
KeyPoint
>
lkp
=
mkp
.
toList
();
order
(
lkp
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
lkp
,
EPS
);
}
...
...
@@ -98,13 +100,14 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
writeFile
(
filename
,
"%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
Mat
cross
=
getTestImg
();
detector
.
detect
(
cross
,
keypoints
);
order
(
keypoints
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
keypoints
,
EPS
);
List
<
KeyPoint
>
lkp
=
keypoints
.
toList
();
order
(
lkp
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
lkp
,
EPS
);
}
public
void
testDetectMatListOfKeyPointMat
()
{
...
...
@@ -114,12 +117,13 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
Mat
img
=
getTestImg
();
Mat
mask
=
getMaskImg
();
List
<
KeyPoint
>
keypoints
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
detector
.
detect
(
img
,
keypoints
,
mask
);
order
(
keypoints
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
1
],
truth
[
2
]),
keypoints
,
EPS
);
List
<
KeyPoint
>
lkp
=
keypoints
.
toList
();
order
(
lkp
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
[
1
],
truth
[
2
]),
lkp
,
EPS
);
}
public
void
testEmpty
()
{
...
...
@@ -129,17 +133,17 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
public
void
testRead
()
{
Mat
cross
=
getTestImg
();
List
<
KeyPoint
>
keypoints1
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints1
=
new
MatOfKeyPoint
();
detector
.
detect
(
cross
,
keypoints1
);
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filename
,
"%YAML:1.0\nhessianThreshold: 8000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
);
detector
.
read
(
filename
);
List
<
KeyPoint
>
keypoints2
=
new
ArrayList
<
KeyPoint
>
();
MatOfKeyPoint
keypoints2
=
new
MatOfKeyPoint
();
detector
.
detect
(
cross
,
keypoints2
);
assertTrue
(
keypoints2
.
size
()
<=
keypoints1
.
size
());
assertTrue
(
keypoints2
.
total
()
<=
keypoints1
.
total
());
}
public
void
testWrite
()
{
...
...
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