Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
25db4538
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
25db4538
编写于
8月 03, 2011
作者:
A
Andrey Pavlenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Java API: (per code review) renaming and moving utility classes
Testing: 1079/0/584
上级
02d5d93c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
78 addition
and
78 deletion
+78
-78
modules/java/android_test/src/org/opencv/test/ConvertersTest.java
...java/android_test/src/org/opencv/test/ConvertersTest.java
+1
-1
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/core/coreTest.java
.../java/android_test/src/org/opencv/test/core/coreTest.java
+1
-1
modules/java/gen_java.py
modules/java/gen_java.py
+1
-1
modules/java/src/cpp/utils.cpp
modules/java/src/cpp/utils.cpp
+4
-4
modules/java/src/java/android+Utils.java
modules/java/src/java/android+Utils.java
+62
-62
modules/java/src/java/utils+Converters.java
modules/java/src/java/utils+Converters.java
+5
-5
未找到文件。
modules/java/android_test/src/org/opencv/test/ConvertersTest.java
浏览文件 @
25db4538
...
...
@@ -3,7 +3,7 @@ package org.opencv.test;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.Converters
;
import
org.opencv.
utils.
Converters
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
...
...
modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java
浏览文件 @
25db4538
...
...
@@ -5,7 +5,7 @@ import android.test.AndroidTestRunner;
import
android.test.InstrumentationTestRunner
;
import
android.util.Log
;
import
org.opencv.
Android
;
import
org.opencv.
android.Utils
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -50,9 +50,9 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
@Override
public
void
onStart
()
{
context
=
getContext
();
LENA_PATH
=
Android
.
ExportResource
(
context
,
R
.
drawable
.
lena
);
CHESS_PATH
=
Android
.
ExportResource
(
context
,
R
.
drawable
.
chessboard
);
LBPCASCADE_FRONTALFACE_PATH
=
Android
.
ExportResource
(
context
,
R
.
raw
.
lbpcascade_frontalface
);
LENA_PATH
=
Utils
.
ExportResource
(
context
,
R
.
drawable
.
lena
);
CHESS_PATH
=
Utils
.
ExportResource
(
context
,
R
.
drawable
.
chessboard
);
LBPCASCADE_FRONTALFACE_PATH
=
Utils
.
ExportResource
(
context
,
R
.
raw
.
lbpcascade_frontalface
);
// List<TestCase> testCases = androidTestRunner.getTestCases();
// Collections.shuffle(testCases); //shuffle the tests order
...
...
modules/java/android_test/src/org/opencv/test/core/coreTest.java
浏览文件 @
25db4538
...
...
@@ -3,7 +3,7 @@ package org.opencv.test.core;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.Converters
;
import
org.opencv.
utils.
Converters
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvException
;
import
org.opencv.core.CvType
;
...
...
modules/java/gen_java.py
浏览文件 @
25db4538
...
...
@@ -811,7 +811,7 @@ extern "C" {
if
ctype
.
startswith
(
'vector'
):
imports
.
add
(
"java.util.List"
)
imports
.
add
(
"org.opencv.core.Mat"
)
imports
.
add
(
"org.opencv.Converters"
)
imports
.
add
(
"org.opencv.
utils.
Converters"
)
ctype
=
ctype
.
replace
(
'vector_'
,
''
)
j_type
=
''
if
ctype
in
type_dict
:
...
...
modules/java/src/cpp/
Android
.cpp
→
modules/java/src/cpp/
utils
.cpp
浏览文件 @
25db4538
...
...
@@ -9,12 +9,12 @@ extern "C" {
#endif
/*
* Class: org_opencv_
Android
* Class: org_opencv_
android_Utils
* Method: nBitmapToMat(Bitmap b)
* Signature: (L)J
*/
JNIEXPORT
jlong
JNICALL
Java_org_opencv_
Android
_nBitmapToMat
JNIEXPORT
jlong
JNICALL
Java_org_opencv_
android_Utils
_nBitmapToMat
(
JNIEnv
*
env
,
jclass
cls
,
jobject
bitmap
)
{
AndroidBitmapInfo
info
;
...
...
@@ -40,11 +40,11 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Android_nBitmapToMat
}
/*
* Class: org_opencv_
Android
* Class: org_opencv_
android_Utils
* Method: nBitmapToMat(long m, Bitmap b)
* Signature: (JL)Z
*/
JNIEXPORT
jboolean
JNICALL
Java_org_opencv_
Android
_nMatToBitmap
JNIEXPORT
jboolean
JNICALL
Java_org_opencv_
android_Utils
_nMatToBitmap
(
JNIEnv
*
env
,
jclass
cls
,
jlong
m
,
jobject
bitmap
)
{
AndroidBitmapInfo
info
;
...
...
modules/java/src/java/
Android
.java
→
modules/java/src/java/
android+Utils
.java
浏览文件 @
25db4538
package
org.opencv
;
import
org.opencv.core.CvException
;
import
org.opencv.core.Mat
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
public
class
Android
{
public
static
String
ExportResource
(
Context
context
,
int
resourceId
)
{
return
ExportResource
(
context
,
resourceId
,
"OpenCV_data"
);
}
public
static
String
ExportResource
(
Context
context
,
int
resourceId
,
String
dirname
)
{
String
fullname
=
context
.
getResources
().
getString
(
resourceId
);
String
resName
=
fullname
.
substring
(
fullname
.
lastIndexOf
(
"/"
)
+
1
);
try
{
InputStream
is
=
context
.
getResources
().
openRawResource
(
resourceId
);
File
resDir
=
context
.
getDir
(
dirname
,
Context
.
MODE_PRIVATE
);
File
resFile
=
new
File
(
resDir
,
resName
);
FileOutputStream
os
=
new
FileOutputStream
(
resFile
);
byte
[]
buffer
=
new
byte
[
4096
];
int
bytesRead
;
while
((
bytesRead
=
is
.
read
(
buffer
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
is
.
close
();
os
.
close
();
return
resFile
.
getAbsolutePath
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
new
CvException
(
"Failed to export resource "
+
resName
+
". Exception thrown: "
+
e
);
}
}
public
static
Mat
BitmapToMat
(
Bitmap
b
)
{
return
new
Mat
(
nBitmapToMat
(
b
));
}
public
static
boolean
MatToBitmap
(
Mat
m
,
Bitmap
b
)
{
return
nMatToBitmap
(
m
.
nativeObj
,
b
);
}
// native stuff
static
{
System
.
loadLibrary
(
"opencv_java"
);
}
private
static
native
long
nBitmapToMat
(
Bitmap
b
);
private
static
native
boolean
nMatToBitmap
(
long
m
,
Bitmap
b
);
}
package
org.opencv
.android
;
import
org.opencv.core.CvException
;
import
org.opencv.core.Mat
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
public
class
Utils
{
public
static
String
ExportResource
(
Context
context
,
int
resourceId
)
{
return
ExportResource
(
context
,
resourceId
,
"OpenCV_data"
);
}
public
static
String
ExportResource
(
Context
context
,
int
resourceId
,
String
dirname
)
{
String
fullname
=
context
.
getResources
().
getString
(
resourceId
);
String
resName
=
fullname
.
substring
(
fullname
.
lastIndexOf
(
"/"
)
+
1
);
try
{
InputStream
is
=
context
.
getResources
().
openRawResource
(
resourceId
);
File
resDir
=
context
.
getDir
(
dirname
,
Context
.
MODE_PRIVATE
);
File
resFile
=
new
File
(
resDir
,
resName
);
FileOutputStream
os
=
new
FileOutputStream
(
resFile
);
byte
[]
buffer
=
new
byte
[
4096
];
int
bytesRead
;
while
((
bytesRead
=
is
.
read
(
buffer
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
is
.
close
();
os
.
close
();
return
resFile
.
getAbsolutePath
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
new
CvException
(
"Failed to export resource "
+
resName
+
". Exception thrown: "
+
e
);
}
}
public
static
Mat
BitmapToMat
(
Bitmap
b
)
{
return
new
Mat
(
nBitmapToMat
(
b
));
}
public
static
boolean
MatToBitmap
(
Mat
m
,
Bitmap
b
)
{
return
nMatToBitmap
(
m
.
nativeObj
,
b
);
}
// native stuff
static
{
System
.
loadLibrary
(
"opencv_java"
);
}
private
static
native
long
nBitmapToMat
(
Bitmap
b
);
private
static
native
boolean
nMatToBitmap
(
long
m
,
Bitmap
b
);
}
modules/java/src/java/Converters.java
→
modules/java/src/java/
utils+
Converters.java
浏览文件 @
25db4538
package
org.opencv
;
package
org.opencv
.utils
;
import
java.util.List
;
...
...
@@ -475,7 +475,7 @@ public class Converters {
return
res
;
}
public
static
Mat
vector_DMatch_to_Mat
(
List
<
DMatch
>
matches
)
{
public
static
Mat
vector_DMatch_to_Mat
(
List
<
DMatch
>
matches
)
{
Mat
res
;
int
count
=
(
matches
!=
null
)
?
matches
.
size
()
:
0
;
if
(
count
>
0
){
...
...
@@ -493,8 +493,8 @@ public class Converters {
res
=
new
Mat
();
}
return
res
;
}
}
public
static
void
Mat_to_vector_DMatch
(
Mat
m
,
List
<
DMatch
>
matches
)
{
if
(
matches
==
null
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"Output List can't be null"
);
...
...
@@ -507,7 +507,7 @@ public class Converters {
double
[]
buff
=
new
double
[
4
*
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
matches
.
add
(
new
DMatch
(
(
int
)
buff
[
4
*
i
],
(
int
)
buff
[
4
*
i
+
1
],
(
int
)
buff
[
4
*
i
+
2
],
(
float
)
buff
[
4
*
i
+
3
]
)
);
matches
.
add
(
new
DMatch
(
(
int
)
buff
[
4
*
i
],
(
int
)
buff
[
4
*
i
+
1
],
(
int
)
buff
[
4
*
i
+
2
],
(
float
)
buff
[
4
*
i
+
3
]
)
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录