Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
e1cd84bb
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e1cd84bb
编写于
8月 03, 2011
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Java API: added and fixed several tests
上级
19c3cf45
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
84 addition
and
6 deletion
+84
-6
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
...va/android_test/src/org/opencv/test/OpenCVTestRunner.java
+5
-0
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
...android_test/src/org/opencv/test/calib3d/calib3dTest.java
+1
-1
modules/java/android_test/src/org/opencv/test/features2d/features2dTest.java
...d_test/src/org/opencv/test/features2d/features2dTest.java
+78
-0
modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java
...id_test/src/org/opencv/test/highgui/VideoCaptureTest.java
+0
-5
未找到文件。
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
浏览文件 @
e1cd84bb
...
...
@@ -70,4 +70,9 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
androidTestRunner
=
super
.
getAndroidTestRunner
();
return
androidTestRunner
;
}
public
static
String
getOutputFileName
(
String
name
)
{
return
context
.
getExternalFilesDir
(
null
).
getAbsolutePath
()
+
File
.
separatorChar
+
name
;
}
}
modules/java/android_test/src/org/opencv/test/calib3d/calib3dTest.java
浏览文件 @
e1cd84bb
...
...
@@ -242,7 +242,7 @@ public class calib3dTest extends OpenCVTestCase {
List
<
Point
>
pts1
=
new
ArrayList
<
Point
>();
List
<
Point
>
pts2
=
new
ArrayList
<
Point
>();
int
minFundamentalMatPoints
=
9
;
// FIXME: probably should be 8 (see ticket #1262)
int
minFundamentalMatPoints
=
8
;
for
(
int
i
=
0
;
i
<
minFundamentalMatPoints
;
i
++)
{
double
x
=
Math
.
random
()
*
100
-
50
;
double
y
=
Math
.
random
()
*
100
-
50
;
...
...
modules/java/android_test/src/org/opencv/test/features2d/features2dTest.java
浏览文件 @
e1cd84bb
package
org.opencv.test.features2d
;
import
org.opencv.calib3d.Calib3d
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Range
;
import
org.opencv.features2d.DMatch
;
import
org.opencv.features2d.DescriptorExtractor
;
import
org.opencv.features2d.DescriptorMatcher
;
import
org.opencv.features2d.FeatureDetector
;
import
org.opencv.features2d.Features2d
;
import
org.opencv.features2d.KeyPoint
;
import
org.opencv.highgui.Highgui
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.test.OpenCVTestRunner
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
features2dTest
extends
OpenCVTestCase
{
public
void
testPTOD
()
{
String
detectorCfg
=
"%YAML:1.0\nhessianThreshold: 4000.\noctaves: 3\noctaveLayers: 4\nupright: 0\n"
;
String
extractorCfg
=
"%YAML:1.0\nnOctaves: 4\nnOctaveLayers: 2\nextended: 0\nupright: 0\n"
;
FeatureDetector
detector
=
FeatureDetector
.
create
(
FeatureDetector
.
SURF
);
DescriptorExtractor
extractor
=
DescriptorExtractor
.
create
(
DescriptorExtractor
.
SURF
);
DescriptorMatcher
matcher
=
DescriptorMatcher
.
create
(
DescriptorMatcher
.
BRUTEFORCE
);
String
detectorCfgFile
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
detectorCfgFile
,
detectorCfg
);
detector
.
read
(
detectorCfgFile
);
String
extractorCfgFile
=
OpenCVTestRunner
.
getTempFileName
(
"yml"
);
writeFile
(
extractorCfgFile
,
extractorCfg
);
extractor
.
read
(
extractorCfgFile
);
Mat
imgTrain
=
Highgui
.
imread
(
OpenCVTestRunner
.
LENA_PATH
,
Highgui
.
CV_LOAD_IMAGE_GRAYSCALE
);
Mat
imgQuery
=
imgTrain
.
submat
(
new
Range
(
0
,
imgTrain
.
rows
()-
100
),
Range
.
all
());
List
<
KeyPoint
>
trainKeypoints
=
new
ArrayList
<
KeyPoint
>();
List
<
KeyPoint
>
queryKeypoints
=
new
ArrayList
<
KeyPoint
>();
detector
.
detect
(
imgTrain
,
trainKeypoints
);
detector
.
detect
(
imgQuery
,
queryKeypoints
);
//OpenCVTestRunner.Log("Keypoints found: " + trainKeypoints.size() + ":" + queryKeypoints.size());
Mat
trainDescriptors
=
new
Mat
();
Mat
queryDescriptors
=
new
Mat
();
extractor
.
compute
(
imgTrain
,
trainKeypoints
,
trainDescriptors
);
extractor
.
compute
(
imgQuery
,
queryKeypoints
,
queryDescriptors
);
List
<
DMatch
>
matches
=
new
ArrayList
<
DMatch
>();
matcher
.
add
(
Arrays
.
asList
(
trainDescriptors
));
matcher
.
match
(
queryDescriptors
,
matches
);
//OpenCVTestRunner.Log("Matches found: " + matches.size());
List
<
Point
>
points1
=
new
ArrayList
<
Point
>();
List
<
Point
>
points2
=
new
ArrayList
<
Point
>();
for
(
int
i
=
0
;
i
<
matches
.
size
();
i
++){
DMatch
match
=
matches
.
get
(
i
);
points1
.
add
(
trainKeypoints
.
get
(
match
.
trainIdx
).
pt
);
points2
.
add
(
queryKeypoints
.
get
(
match
.
queryIdx
).
pt
);
}
Mat
hmg
=
Calib3d
.
findHomography
(
points1
,
points2
,
Calib3d
.
RANSAC
);
assertMatEqual
(
Mat
.
eye
(
3
,
3
,
CvType
.
CV_64F
),
hmg
,
EPS
);
Mat
outimg
=
new
Mat
();
Features2d
.
drawMatches
(
imgQuery
,
queryKeypoints
,
imgTrain
,
trainKeypoints
,
matches
,
outimg
);
String
outputPath
=
OpenCVTestRunner
.
getOutputFileName
(
"PTODresult.png"
);
Highgui
.
imwrite
(
outputPath
,
outimg
);
//OpenCVTestRunner.Log("Output image is saved to: " + outputPath);
}
}
modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java
浏览文件 @
e1cd84bb
...
...
@@ -122,9 +122,4 @@ public class VideoCaptureTest extends OpenCVTestCase {
capture
.
release
();
assertTrue
(
isOpened
);
}
public
void
testVideoCaptureString
()
{
fail
(
"Not yet implemented"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录