Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
1649c8f6
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
1649c8f6
编写于
7月 04, 2011
作者:
K
Kirill Kornyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some tests for highgui java added
上级
5596c792
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
104 addition
and
10 deletion
+104
-10
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+27
-3
modules/java/android_test/src/org/opencv/test/coreTest.java
modules/java/android_test/src/org/opencv/test/coreTest.java
+9
-6
modules/java/android_test/src/org/opencv/test/highguiTest.java
...es/java/android_test/src/org/opencv/test/highguiTest.java
+68
-1
未找到文件。
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
浏览文件 @
1649c8f6
package
org.opencv.test
;
import
java.io.FileOutputStream
;
import
org.opencv.Mat
;
import
org.opencv.core
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.test.AndroidTestCase
;
import
android.util.Log
;
public
class
OpenCVTestCase
extends
AndroidTestCase
{
static
String
TAG
=
"OpenCV_JavaAPI_Tests"
;
static
String
LENA
=
"/data/data/org.opencv.test/files/lena.jpg"
;
static
int
matSize
=
10
;
static
Mat
gray0
;
...
...
@@ -43,6 +51,11 @@ public class OpenCVTestCase extends AndroidTestCase {
// Log.e(TAG, "setUp");
super
.
setUp
();
//Naming notation: channels_[type]_[dimension]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d - refactor ;)
gray0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray0
.
setTo
(
0.0
);
gray1
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray1
.
setTo
(
1.0
);
gray2
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC1
);
gray2
.
setTo
(
2.0
);
...
...
@@ -69,9 +82,20 @@ public class OpenCVTestCase extends AndroidTestCase {
rgba0
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba0
.
setTo
(
0
,
0
,
0
,
0
);
rgba128
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_8UC4
);
rgba128
.
setTo
(
128
,
128
,
128
,
128
);
dst_gray
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_8UC1
);
try
{
Bitmap
mBitmap
=
BitmapFactory
.
decodeResource
(
this
.
getContext
().
getResources
(),
R
.
drawable
.
lena
);
FileOutputStream
fos
=
this
.
getContext
().
openFileOutput
(
"lena.jpg"
,
Context
.
MODE_WORLD_READABLE
);
mBitmap
.
compress
(
CompressFormat
.
JPEG
,
100
,
fos
);
fos
.
flush
();
fos
.
close
();
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Tried to write lena.jpg, but: "
+
e
.
toString
());
}
dst_gray
=
new
Mat
();
assertTrue
(
dst_gray
.
empty
());
dst_gray_32f
=
new
Mat
(
0
,
0
,
Mat
.
CvType
.
CV_32FC1
);
dst_gray_32f
=
new
Mat
();
assertTrue
(
dst_gray_32f
.
empty
());
}
...
...
modules/java/android_test/src/org/opencv/test/coreTest.java
浏览文件 @
1649c8f6
...
...
@@ -30,7 +30,7 @@ public class coreTest extends OpenCVTestCase {
public
void
testMahalanobis
()
{
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
grayRnd_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
covar
.
inv
();
Mat
line1
=
grayRnd_32f
.
submat
(
0
,
1
,
0
,
grayRnd_32f
.
cols
());
...
...
@@ -110,7 +110,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_32FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
,
Mat
.
CvType
.
CV_32F
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
assertMatEqual
(
gray0_32f
,
covar
);
assertMatEqual
(
gray0_32f_1d
,
mean
);
}
...
...
@@ -119,7 +119,7 @@ public class coreTest extends OpenCVTestCase {
Mat
covar
=
new
Mat
(
matSize
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
Mat
mean
=
new
Mat
(
1
,
matSize
,
Mat
.
CvType
.
CV_64FC1
);
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
);
//FIXME: CV_COVAR_NORMAL
core
.
calcCovarMatrix
(
gray0_32f
,
covar
,
mean
,
8
|
1
);
//FIXME: CV_COVAR_NORMAL
instead of magic numbers
assertMatEqual
(
gray0_64f
,
covar
);
assertMatEqual
(
gray0_64f_1d
,
mean
);
}
...
...
@@ -133,7 +133,8 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testCheckHardwareSupport
()
{
boolean
hasFeauture
=
core
.
checkHardwareSupport
(
0
);
//FIXME: do we need this function?
//FIXME: do we need this function?
boolean
hasFeauture
=
core
.
checkHardwareSupport
(
0
);
assertEquals
(
false
,
hasFeauture
);
}
...
...
@@ -414,7 +415,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testMulSpectrumsMatMatMatInt
()
{
//TODO:
complex math. See the dct function test.
//TODO:
nice example
fail
(
"Not yet implemented"
);
}
...
...
@@ -498,7 +499,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testPerspectiveTransform
()
{
//
XXX: kirill stopped her
e
//
TODO: nice exampl
e
fail
(
"Not yet implemented"
);
}
...
...
@@ -571,6 +572,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testSetUseOptimized
()
{
//FIXME: do we need this function?
fail
(
"Not yet implemented"
);
}
...
...
@@ -627,6 +629,7 @@ public class coreTest extends OpenCVTestCase {
}
public
void
testUseOptimized
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
...
...
modules/java/android_test/src/org/opencv/test/highguiTest.java
浏览文件 @
1649c8f6
package
org.opencv.test
;
import
java.io.FileOutputStream
;
import
org.opencv.Mat
;
import
org.opencv.highgui
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap.CompressFormat
;
import
android.graphics.BitmapFactory
;
import
android.util.Log
;
public
class
highguiTest
extends
OpenCVTestCase
{
public
void
testDestroyAllWindows
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testDestroyWindow
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testGetTrackbarPos
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testGetWindowProperty
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testImdecode
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testStartWindowThread
()
{
public
void
testImreadStringInt
()
{
dst_gray
=
highgui
.
imread
(
LENA
,
0
);
assertTrue
(!
dst_gray
.
empty
());
assertEquals
(
1
,
dst_gray
.
channels
());
}
public
void
testImreadString
()
{
dst_gray
=
highgui
.
imread
(
LENA
);
assertTrue
(!
dst_gray
.
empty
());
assertEquals
(
3
,
dst_gray
.
channels
());
}
public
void
testImshow
()
{
fail
(
"Not yet implemented"
);
}
public
void
testNamedWindowStringInt
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testNamedWindowString
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testSetTrackbarPos
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testSetWindowProperty
()
{
//XXX: do we need this function?
fail
(
"Not yet implemented"
);
}
public
void
testStartWindowThread
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testWaitKeyInt
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
}
public
void
testWaitKey
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录