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
af198233
Commit
af198233
authored
Apr 11, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: fixing more tests
parent
570ec2f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
59 deletions
+14
-59
CoreTest.java
.../java/android_test/src/org/opencv/test/core/CoreTest.java
+1
-1
BruteForceDescriptorMatcherTest.java
...encv/test/features2d/BruteForceDescriptorMatcherTest.java
+4
-2
FlannBasedDescriptorMatcherTest.java
...encv/test/features2d/FlannBasedDescriptorMatcherTest.java
+9
-56
No files found.
modules/java/android_test/src/org/opencv/test/core/CoreTest.java
View file @
af198233
...
...
@@ -804,7 +804,7 @@ public class CoreTest extends OpenCVTestCase {
public
void
testGetNumberOfCPUs
()
{
int
cpus
=
Core
.
getNumberOfCPUs
();
assert
Equals
(
Runtime
.
getRuntime
().
availableProcessors
(),
cpus
);
assert
True
(
Runtime
.
getRuntime
().
availableProcessors
()
<=
cpus
);
}
public
void
testGetOptimalDFTSize
()
{
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
View file @
af198233
...
...
@@ -180,16 +180,18 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
Mat
query
=
getQueryDescriptors
();
List
<
MatOfDMatch
>
matches
=
new
ArrayList
<
MatOfDMatch
>();
matcher
.
knnMatch
(
query
,
train
,
matches
,
k
);
Log
.
d
(
"knnMatch"
,
"train = "
+
train
);
Log
.
d
(
"knnMatch"
,
"query = "
+
query
);
/*
matcher.add(
Arrays.asList(train)
);
matcher.add(
train
);
matcher.knnMatch(query, matches, k);
*/
assertEquals
(
query
.
rows
(),
matches
.
size
());
for
(
int
i
=
0
;
i
<
matches
.
size
();
i
++)
{
MatOfDMatch
vdm
=
matches
.
get
(
i
);
assertEquals
(
Math
.
min
(
k
,
train
.
total
()),
vdm
.
total
());
Log
.
d
(
"knn"
,
"vdm["
+
i
+
"]="
+
vdm
.
dump
());
assertTrue
(
Math
.
min
(
k
,
train
.
rows
())
>=
vdm
.
total
());
for
(
DMatch
dm
:
vdm
.
toArray
())
{
assertEquals
(
dm
.
queryIdx
,
i
);
...
...
modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
View file @
af198233
...
...
@@ -87,7 +87,7 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
+
" -\n"
+
" name: eps\n"
+
" type: 5\n"
+
" value:
0.\n"
+
" value:
4.\n"
// this line is changed!
+
" -\n"
+
" name: sorted\n"
+
" type: 15\n"
...
...
@@ -99,39 +99,6 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
DMatch
[]
truth
;
private
Mat
getBriefQueryDescriptors
()
{
return
getBriefTestDescriptors
(
getBriefQueryImg
());
}
private
Mat
getBriefQueryImg
()
{
Mat
img
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
255
));
Core
.
line
(
img
,
new
Point
(
40
,
matSize
-
40
),
new
Point
(
matSize
-
50
,
50
),
new
Scalar
(
0
),
8
);
return
img
;
}
private
Mat
getBriefTestDescriptors
(
Mat
img
)
{
MatOfKeyPoint
keypoints
=
new
MatOfKeyPoint
();
Mat
descriptors
=
new
Mat
();
FeatureDetector
detector
=
FeatureDetector
.
create
(
FeatureDetector
.
FAST
);
DescriptorExtractor
extractor
=
DescriptorExtractor
.
create
(
DescriptorExtractor
.
BRIEF
);
detector
.
detect
(
img
,
keypoints
);
extractor
.
compute
(
img
,
keypoints
,
descriptors
);
return
descriptors
;
}
private
Mat
getBriefTrainDescriptors
()
{
return
getBriefTestDescriptors
(
getBriefTrainImg
());
}
private
Mat
getBriefTrainImg
()
{
Mat
img
=
new
Mat
(
matSize
,
matSize
,
CvType
.
CV_8U
,
new
Scalar
(
255
));
Core
.
line
(
img
,
new
Point
(
40
,
40
),
new
Point
(
matSize
-
40
,
matSize
-
40
),
new
Scalar
(
0
),
8
);
return
img
;
}
private
Mat
getMaskImg
()
{
return
new
Mat
(
5
,
2
,
CvType
.
CV_8U
,
new
Scalar
(
0
))
{
{
...
...
@@ -364,28 +331,14 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
}
public
void
testRead
()
{
String
filename
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filename
,
ymlParamsModified
);
matcher
.
read
(
filename
);
Mat
train
=
getBriefTrainDescriptors
();
Mat
query
=
getBriefQueryDescriptors
();
MatOfDMatch
matches
=
new
MatOfDMatch
();
matcher
.
match
(
query
,
train
,
matches
);
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)
*/
new
DMatch
(
1
,
2
,
0
,
42
),
new
DMatch
(
2
,
1
,
0
,
40
),
new
DMatch
(
3
,
3
,
0
,
53
)
},
matches
.
toArray
(),
EPS
);
String
filenameR
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
String
filenameW
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
filenameR
,
ymlParamsModified
);
matcher
.
read
(
filenameR
);
matcher
.
write
(
filenameW
);
assertEquals
(
ymlParamsModified
,
readFile
(
filenameW
));
}
public
void
testTrain
()
{
...
...
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