Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenCV
opencv
提交
efdc055f
O
opencv
项目概览
OpenCV
/
opencv
上一次同步 9 个月
通知
994
Star
71100
Fork
55581
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
efdc055f
编写于
7月 03, 2012
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed Java API tests
上级
5615ec7c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
66 addition
and
80 deletion
+66
-80
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+13
-13
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
...va/android_test/src/org/opencv/test/OpenCVTestRunner.java
+4
-4
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
...encv/test/features2d/BruteForceDescriptorMatcherTest.java
+9
-10
modules/java/android_test/src/org/opencv/test/features2d/BruteForceL1DescriptorMatcherTest.java
...cv/test/features2d/BruteForceL1DescriptorMatcherTest.java
+5
-6
modules/java/android_test/src/org/opencv/test/features2d/BruteForceSL2DescriptorMatcherTest.java
...v/test/features2d/BruteForceSL2DescriptorMatcherTest.java
+9
-7
modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
...encv/test/features2d/FlannBasedDescriptorMatcherTest.java
+8
-9
modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
...g/opencv/test/features2d/SURFDescriptorExtractorTest.java
+12
-19
modules/java/android_test/src/org/opencv/test/features2d/SURFFeatureDetectorTest.java
...c/org/opencv/test/features2d/SURFFeatureDetectorTest.java
+6
-12
未找到文件。
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
浏览文件 @
efdc055f
...
...
@@ -25,10 +25,10 @@ import org.opencv.highgui.Highgui;
public
class
OpenCVTestCase
extends
TestCase
{
//change to 'true' to unblock fail on fail("Not yet implemented")
public
static
final
boolean
passNYI
=
true
;
protected
static
final
int
matSize
=
10
;
//change to 'true' to unblock fail on fail("Not yet implemented")
public
static
final
boolean
passNYI
=
true
;
protected
static
final
int
matSize
=
10
;
protected
static
final
double
EPS
=
0.001
;
protected
static
final
double
weakEPS
=
0.5
;
...
...
@@ -185,11 +185,11 @@ public class OpenCVTestCase extends TestCase {
}
public
static
void
fail
(
String
msg
)
{
if
(
msg
==
"Not yet implemented"
&&
passNYI
)
return
;
TestCase
.
fail
(
msg
);
if
(
msg
==
"Not yet implemented"
&&
passNYI
)
return
;
TestCase
.
fail
(
msg
);
}
public
static
<
E
extends
Number
>
void
assertListEquals
(
List
<
E
>
list1
,
List
<
E
>
list2
)
{
if
(
list1
.
size
()
!=
list2
.
size
())
{
throw
new
UnsupportedOperationException
();
...
...
@@ -220,7 +220,7 @@ public class OpenCVTestCase extends TestCase {
}
for
(
int
i
=
0
;
i
<
ar1
.
length
;
i
++)
assertEquals
(
ar1
[
i
].
doubleValue
(),
ar2
[
i
].
doubleValue
(),
epsilon
);
assertEquals
(
ar1
[
i
].
doubleValue
(),
ar2
[
i
].
doubleValue
(),
epsilon
);
//assertTrue(Math.abs(ar1[i].doubleValue() - ar2[i].doubleValue()) <= epsilon);
}
...
...
@@ -230,7 +230,7 @@ public class OpenCVTestCase extends TestCase {
}
for
(
int
i
=
0
;
i
<
ar1
.
length
;
i
++)
assertEquals
(
ar1
[
i
],
ar2
[
i
],
epsilon
);
assertEquals
(
ar1
[
i
],
ar2
[
i
],
epsilon
);
//assertTrue(Math.abs(ar1[i].doubleValue() - ar2[i].doubleValue()) <= epsilon);
}
...
...
@@ -341,9 +341,9 @@ public class OpenCVTestCase extends TestCase {
}
public
static
void
assertListDMatchEquals
(
List
<
DMatch
>
expected
,
List
<
DMatch
>
actual
,
double
epsilon
)
{
DMatch
expectedArray
[]
=
expected
.
toArray
(
new
DMatch
[
0
]);
DMatch
actualArray
[]
=
actual
.
toArray
(
new
DMatch
[
0
]);
assertArrayDMatchEquals
(
expectedArray
,
actualArray
,
epsilon
);
DMatch
expectedArray
[]
=
expected
.
toArray
(
new
DMatch
[
0
]);
DMatch
actualArray
[]
=
actual
.
toArray
(
new
DMatch
[
0
]);
assertArrayDMatchEquals
(
expectedArray
,
actualArray
,
epsilon
);
}
public
static
void
assertPointEquals
(
Point
expected
,
Point
actual
,
double
eps
)
{
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
浏览文件 @
efdc055f
...
...
@@ -17,15 +17,15 @@ import android.util.Log;
/**
* This only class is Android specific.
*
*
* @see <a href="http://opencv.itseez.com">OpenCV</a>
*/
public
class
OpenCVTestRunner
extends
InstrumentationTestRunner
{
static
{
System
.
loadLibrary
(
"opencv_java"
);
}
public
static
String
LENA_PATH
;
static
{
System
.
loadLibrary
(
"opencv_java"
);
}
public
static
String
LENA_PATH
;
public
static
String
CHESS_PATH
;
public
static
String
LBPCASCADE_FRONTALFACE_PATH
;
public
static
Context
context
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceDescriptorMatcherTest.java
浏览文件 @
efdc055f
...
...
@@ -84,11 +84,11 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
matSize
=
100
;
truth
=
new
DMatch
[]
{
new
DMatch
(
0
,
0
,
0
,
1.049694f
),
new
DMatch
(
1
,
0
,
0
,
1.098605
f
),
new
DMatch
(
2
,
1
,
0
,
0.494587f
),
new
DMatch
(
3
,
1
,
0
,
0.484352
f
),
new
DMatch
(
4
,
0
,
0
,
1.083795
f
)
new
DMatch
(
0
,
0
,
0
,
1.049694f
),
new
DMatch
(
1
,
0
,
0
,
1.066820
f
),
new
DMatch
(
2
,
1
,
0
,
0.494587f
),
new
DMatch
(
3
,
0
,
0
,
1.141826
f
),
new
DMatch
(
4
,
0
,
0
,
1.084099
f
)
};
super
.
setUp
();
...
...
@@ -166,7 +166,7 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
}
public
void
testKnnMatchMatMatListOfListOfDMatchInt
()
{
final
int
k
=
3
;
final
int
k
=
3
;
Mat
train
=
getTrainDescriptors
();
Mat
query
=
getQueryDescriptors
();
List
<
MatOfDMatch
>
matches
=
new
ArrayList
<
MatOfDMatch
>();
...
...
@@ -181,12 +181,12 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
assertEquals
(
query
.
rows
(),
matches
.
size
());
for
(
int
i
=
0
;
i
<
matches
.
size
();
i
++)
{
MatOfDMatch
vdm
=
matches
.
get
(
i
);
//Log.d("knn", "vdm["+i+"]="+vdm.dump());
MatOfDMatch
vdm
=
matches
.
get
(
i
);
//Log.d("knn", "vdm["+i+"]="+vdm.dump());
assertTrue
(
Math
.
min
(
k
,
train
.
rows
())
>=
vdm
.
total
());
for
(
DMatch
dm
:
vdm
.
toArray
())
{
assertEquals
(
dm
.
queryIdx
,
i
);
assertEquals
(
dm
.
queryIdx
,
i
);
}
}
}
...
...
@@ -206,7 +206,6 @@ public class BruteForceDescriptorMatcherTest extends OpenCVTestCase {
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
match
(
query
,
matches
);
assertArrayDMatchEquals
(
truth
,
matches
.
toArray
(),
EPS
);
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceL1DescriptorMatcherTest.java
浏览文件 @
efdc055f
...
...
@@ -84,11 +84,11 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
matSize
=
100
;
truth
=
new
DMatch
[]
{
new
DMatch
(
0
,
1
,
0
,
6.9202342f
),
new
DMatch
(
1
,
1
,
0
,
6.1675916f
),
new
DMatch
(
2
,
1
,
0
,
2.6798589f
),
new
DMatch
(
3
,
1
,
0
,
2.6545324f
),
new
DMatch
(
4
,
0
,
0
,
6.1294847
f
)
new
DMatch
(
0
,
1
,
0
,
6.9202332f
),
new
DMatch
(
1
,
0
,
0
,
6.0567350f
),
new
DMatch
(
2
,
1
,
0
,
2.6798587f
),
new
DMatch
(
3
,
0
,
0
,
5.8991642f
),
new
DMatch
(
4
,
0
,
0
,
6.1321812
f
)
};
super
.
setUp
();
}
...
...
@@ -183,7 +183,6 @@ public class BruteForceL1DescriptorMatcherTest extends OpenCVTestCase {
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
match
(
query
,
matches
);
assertArrayDMatchEquals
(
truth
,
matches
.
toArray
(),
EPS
);
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/BruteForceSL2DescriptorMatcherTest.java
浏览文件 @
efdc055f
...
...
@@ -31,7 +31,7 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
}
};
}
/*
private float sqr(float val){
return val * val;
...
...
@@ -89,11 +89,11 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
matSize
=
100
;
truth
=
new
DMatch
[]
{
new
DMatch
(
0
,
0
,
0
,
1.1018577f
),
new
DMatch
(
1
,
0
,
0
,
1.2069331f
),
new
DMatch
(
2
,
1
,
0
,
0.2446168f
),
new
DMatch
(
3
,
1
,
0
,
0.2345972f
),
new
DMatch
(
4
,
0
,
0
,
1.1746116
f
)
new
DMatch
(
0
,
0
,
0
,
1.1018578f
),
new
DMatch
(
1
,
0
,
0
,
1.1381058f
),
new
DMatch
(
2
,
1
,
0
,
0.2446168f
),
new
DMatch
(
3
,
0
,
0
,
1.3037685f
),
new
DMatch
(
4
,
0
,
0
,
1.1752719
f
)
};
super
.
setUp
();
...
...
@@ -189,7 +189,9 @@ public class BruteForceSL2DescriptorMatcherTest extends OpenCVTestCase {
matcher
.
add
(
Arrays
.
asList
(
train
));
matcher
.
match
(
query
,
matches
);
OpenCVTestRunner
.
Log
(
matches
);
OpenCVTestRunner
.
Log
(
matches
);
OpenCVTestRunner
.
Log
(
matches
);
assertArrayDMatchEquals
(
truth
,
matches
.
toArray
(),
EPS
);
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/FlannBasedDescriptorMatcherTest.java
浏览文件 @
efdc055f
...
...
@@ -158,11 +158,11 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
matSize
=
100
;
truth
=
new
DMatch
[]
{
new
DMatch
(
0
,
0
,
0
,
1.049694f
),
new
DMatch
(
1
,
0
,
0
,
1.098605f
),
new
DMatch
(
2
,
1
,
0
,
0.494587f
),
new
DMatch
(
3
,
1
,
0
,
0.484352f
),
new
DMatch
(
4
,
0
,
0
,
1.083795
f
)
new
DMatch
(
0
,
0
,
0
,
1.049694f
),
new
DMatch
(
1
,
0
,
0
,
1.066820f
),
new
DMatch
(
2
,
1
,
0
,
0.494587f
),
new
DMatch
(
3
,
0
,
0
,
1.141826f
),
new
DMatch
(
4
,
0
,
0
,
1.084099
f
)
};
super
.
setUp
();
...
...
@@ -283,9 +283,8 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
assertArrayDMatchEquals
(
truth
,
matches
.
toArray
(),
EPS
);
// OpenCVTestRunner.Log("matches found: " + matches.size());
// for (DMatch m : matches)
// OpenCVTestRunner.Log(m.toString());
// OpenCVTestRunner.Log(matches.toString());
// OpenCVTestRunner.Log(matches);
}
public
void
testMatchMatMatListOfDMatchMat
()
{
...
...
@@ -330,7 +329,7 @@ public class FlannBasedDescriptorMatcherTest extends OpenCVTestCase {
matcher
.
read
(
filenameR
);
matcher
.
write
(
filenameW
);
assertEquals
(
ymlParamsModified
,
readFile
(
filenameW
));
}
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFDescriptorExtractorTest.java
浏览文件 @
efdc055f
...
...
@@ -47,25 +47,18 @@ public class SURFDescriptorExtractorTest extends OpenCVTestCase {
Mat
truth
=
new
Mat
(
1
,
128
,
CvType
.
CV_32FC1
)
{
{
put
(
0
,
0
,
/*
0, 0, 0, 0, 0.011540107, 0.0029440077, 0.095483348, 0.018144149, 0.00014820647, 0, 0.00014820647, 0, 0, 0, 0, 0, 0, -0.00014820647,
0, 0.00014820647, 0.10196275, 0.0099145742, 0.57075155, 0.047922116, 0, 0, 0, 0, 0, 0, 0, 0, 0.0029440068, -0.011540107, 0.018144149,
0.095483348, 0.085385554, -0.054076977, 0.34105155, 0.47911066, 0.023395451, -0.11012388, 0.088196531, 0.50863767, 0.0031790689,
-0.019882837, 0.0089476965, 0.054817006, -0.0033560959, -0.0011770058, 0.0033560959, 0.0011770058, 0.019882834, 0.0031790687,
0.054817006, 0.0089476984, 0, 0, 0, 0, -0.0011770058, 0.0033560959, 0.0011770058, 0.0033560959
*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0.045382127
,
0.075976953
,
-
0.031969212
,
0.035002094
,
0.012224297
,
0.012286193
,
-
0.0088025155
,
0.0088025155
,
0.00017225844
,
0.00017225844
,
0
,
0
,
8.2743405
e
-
05
,
8.2743405
e
-
05
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
8.2743405
e
-
05
,
8.2743405
e
-
05
,
-
0.00017225844
,
0.00017225844
,
0
,
0
,
0.31723264
,
0.42715758
,
-
0.19872268
,
0.23621935
,
0.033304065
,
0.033918764
,
-
0.021780485
,
0.021780485
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
-
0.0088025145
,
0.0088025145
,
0.012224296
,
0.012286192
,
-
0.045382123
,
0.075976953
,
0.031969212
,
0.035002094
,
0.10047197
,
0.21463872
,
-
0.0012294546
,
0.18176091
,
-
0.075555265
,
0.35627601
,
0.01270232
,
0.20058797
,
-
0.037658721
,
0.037658721
,
0.064850949
,
0.064850949
,
-
0.27688536
,
0.44229308
,
0.14888979
,
0.14888979
,
-
0.0031531656
,
0.0031531656
,
0.0068481555
,
0.0072466261
,
-
0.034193151
,
0.040314503
,
0.01108359
,
0.023398584
,
-
0.00071876607
,
0.00071876607
,
-
0.0031819802
,
0.0031819802
,
0
,
0
,
-
0.0013680183
,
0.0013680183
,
0.034193147
,
0.040314503
,
-
0.01108359
,
0.023398584
,
0.006848156
,
0.0072466265
,
-
0.0031531656
,
0.0031531656
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
-
0.0013680183
,
0.0013680183
,
0
,
0
,
0.00071876607
,
0.00071876607
,
0.0031819802
,
0.0031819802
-
0.0041138371
,
0.0041138371
,
0
,
0
,
0
,
0
,
0.0014427509
,
0.0014427509
,
-
0.0081971241
,
0.034624498
,
0.032569118
,
0.032569118
,
-
0.007222258
,
0.0076424959
,
0.0033254174
,
0.0033254174
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
-
0.10815519
,
0.38033518
,
0.24314292
,
0.24314292
,
-
0.068393648
,
0.068393648
,
0.039715949
,
0.039715949
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
-
8.7263528
e
-
05
,
8.7263528
e
-
05
,
-
6.0081031
e
-
05
,
6.0081031
e
-
05
,
-
0.00012158759
,
0.00012158759
,
0.0033254174
,
0.0033254174
,
-
0.007222258
,
0.0076424964
,
0.0081971241
,
0.034624498
,
-
0.032569118
,
0.032569118
,
-
0.077379324
,
0.27552885
,
0.14366581
,
0.31175563
,
-
0.013609707
,
0.24329227
,
-
0.091054246
,
0.17476201
,
0.022970313
,
0.022970313
,
-
0.035123408
,
0.035771687
,
0.1907353
,
0.3838968
,
-
0.31571922
,
0.31571922
,
0.0092833797
,
0.0092833797
,
-
0.012892088
,
0.012957365
,
0.029558292
,
0.073337689
,
-
0.043703932
,
0.043703932
,
0.0014427509
,
0.0014427509
,
0
,
0
,
0.0041138371
,
0.0041138371
,
0
,
0
,
-
0.02955829
,
0.073337704
,
0.043703932
,
0.043703932
,
-
0.012892087
,
0.012957364
,
0.0092833797
,
0.0092833797
,
6.0081031
e
-
05
,
6.0081031
e
-
05
,
0.00012158759
,
0.00012158759
,
-
8.7263528
e
-
05
,
8.7263528
e
-
05
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
}
};
...
...
modules/java/android_test/src/org/opencv/test/features2d/SURFFeatureDetectorTest.java
浏览文件 @
efdc055f
...
...
@@ -57,17 +57,11 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
matSize
=
100
;
truth
=
new
KeyPoint
[]
{
/*
new KeyPoint(55.775577545166016f, 44.224422454833984f, 16, 9.754629f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 44.224422454833984f, 16, 99.75463f, 8617.863f, 1, -1),
new KeyPoint(44.224422454833984f, 55.775577545166016f, 16, 189.7546f, 8617.863f, 1, -1),
new KeyPoint(55.775577545166016f, 55.775577545166016f, 16, 279.75464f, 8617.863f, 1, -1)
*/
new
KeyPoint
(
55.7755f
,
44.2244f
,
16
,
9.754f
,
8617.863f
,
0
,
-
1
),
new
KeyPoint
(
44.2244f
,
44.2244f
,
16
,
99.754f
,
8617.863f
,
0
,
-
1
),
new
KeyPoint
(
44.2244f
,
55.7755f
,
16
,
189.754f
,
8617.863f
,
0
,
-
1
),
new
KeyPoint
(
55.7755f
,
55.7755f
,
16
,
279.754f
,
8617.863f
,
0
,
-
1
)
};
new
KeyPoint
(
55.775578f
,
55.775578f
,
16
,
80.245735f
,
8617.8633f
,
0
,
-
1
),
new
KeyPoint
(
44.224422f
,
55.775578f
,
16
,
170.24574f
,
8617.8633f
,
0
,
-
1
),
new
KeyPoint
(
44.224422f
,
44.224422f
,
16
,
260.24573f
,
8617.8633f
,
0
,
-
1
),
new
KeyPoint
(
55.775578f
,
44.224422f
,
16
,
350.24573f
,
8617.8633f
,
0
,
-
1
)
};
super
.
setUp
();
}
...
...
@@ -93,7 +87,7 @@ public class SURFFeatureDetectorTest extends OpenCVTestCase {
assertEquals
(
3
,
keypoints
.
size
());
for
(
MatOfKeyPoint
mkp
:
keypoints
)
{
List
<
KeyPoint
>
lkp
=
mkp
.
toList
();
List
<
KeyPoint
>
lkp
=
mkp
.
toList
();
order
(
lkp
);
assertListKeyPointEquals
(
Arrays
.
asList
(
truth
),
lkp
,
EPS
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录