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
4a634696
Commit
4a634696
authored
Apr 28, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: updating OpenCV version, minor Core API improvements, enabling EM.
parent
2efa446e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
251 additions
and
6 deletions
+251
-6
.project
modules/java/android/.project
+1
-1
AndroidManifest.xml
modules/java/android/AndroidManifest.xml
+2
-2
MatTest.java
...s/java/android_test/src/org/opencv/test/core/MatTest.java
+9
-0
core.filelist
modules/java/config/core.filelist
+1
-0
gen_java.py
modules/java/gen_java.py
+10
-3
Mat.cpp
modules/java/src/cpp/Mat.cpp
+186
-0
core_manual.hpp
modules/java/src/cpp/core_manual.hpp
+26
-0
core+Mat.java
modules/java/src/java/core+Mat.java
+16
-0
No files found.
modules/java/android/.project
View file @
4a634696
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
OpenCV-2.4.
beta
</name>
<name>
OpenCV-2.4.
0
</name>
<comment></comment>
<projects>
</projects>
...
...
modules/java/android/AndroidManifest.xml
View file @
4a634696
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.opencv"
android:versionCode=
"
1
"
android:versionName=
"
1
.0"
>
android:versionCode=
"
240
"
android:versionName=
"
2.4
.0"
>
</manifest>
modules/java/android_test/src/org/opencv/test/core/MatTest.java
View file @
4a634696
...
...
@@ -871,6 +871,15 @@ public class MatTest extends OpenCVTestCase {
assertMatEqual
(
gray127
,
gray0
);
}
public
void
testSetToScalarMask
()
{
Mat
mask
=
gray0
.
clone
();
mask
.
put
(
1
,
1
,
1
,
2
,
3
);
gray0
.
setTo
(
new
Scalar
(
1
),
mask
);
assertEquals
(
3
,
Core
.
countNonZero
(
gray0
));
Core
.
subtract
(
gray0
,
mask
,
gray0
);
assertEquals
(
0
,
Core
.
countNonZero
(
gray0
));
}
public
void
testSize
()
{
assertEquals
(
new
Size
(
matSize
,
matSize
),
gray0
.
size
());
...
...
modules/java/config/core.filelist
View file @
4a634696
include/opencv2/core/core.hpp
../java/src/cpp/core_manual.hpp
modules/java/gen_java.py
View file @
4a634696
...
...
@@ -14,7 +14,7 @@ class_ignore_list = (
#features2d
#"KeyPoint", "MSER", "StarDetector", "SURF", "DMatch",
#ml
"EM"
,
#
"EM",
)
const_ignore_list
=
(
...
...
@@ -289,8 +289,15 @@ type_dict = {
"jni_var"
:
'const char* utf_
%(n)
s = env->GetStringUTFChars(
%(n)
s, 0); std::string n_
%(n)
s( utf_
%(n)
s ? utf_
%(n)
s : "" ); env->ReleaseStringUTFChars(
%(n)
s, utf_
%(n)
s)'
,
"suffix"
:
"Ljava_lang_String_2"
},
"TermCriteria"
:
{
"j_type"
:
"TermCriteria"
,
"jn_args"
:
((
"int"
,
".type"
),
(
"int"
,
".maxCount"
),
(
"double"
,
".epsilon"
)),
"jni_var"
:
"TermCriteria
%(n)
s(
%(n)
s_type,
%(n)
s_maxCount,
%(n)
s_epsilon)"
,
"jni_var"
:
"TermCriteria
%(n)
s(
%(n)
s_type,
%(n)
s_maxCount,
%(n)
s_epsilon)"
,
"jni_type"
:
"jdoubleArray"
,
"suffix"
:
"IID"
},
"CvTermCriteria"
:
{
"j_type"
:
"TermCriteria"
,
"jn_args"
:
((
"int"
,
".type"
),
(
"int"
,
".maxCount"
),
(
"double"
,
".epsilon"
)),
"jni_var"
:
"TermCriteria
%(n)
s(
%(n)
s_type,
%(n)
s_maxCount,
%(n)
s_epsilon)"
,
"jni_type"
:
"jdoubleArray"
,
"suffix"
:
"IID"
},
"Vec2d"
:
{
"j_type"
:
"double[]"
,
"jn_args"
:
((
"double"
,
".val[0]"
),
(
"double"
,
".val[1]"
)),
"jn_type"
:
"double[]"
,
"jni_var"
:
"Vec2d
%(n)
s(
%(n)
s_val0,
%(n)
s_val1)"
,
"jni_type"
:
"jdoubleArray"
,
"suffix"
:
"DD"
},
"Vec3d"
:
{
"j_type"
:
"double[]"
,
"jn_args"
:
((
"double"
,
".val[0]"
),
(
"double"
,
".val[1]"
),
(
"double"
,
".val[2]"
)),
"jn_type"
:
"double[]"
,
"jni_var"
:
"Vec3d
%(n)
s(
%(n)
s_val0,
%(n)
s_val1,
%(n)
s_val2)"
,
"jni_type"
:
"jdoubleArray"
,
...
...
@@ -615,7 +622,7 @@ class FuncInfo(object):
if
m
.
startswith
(
"="
):
self
.
jname
=
m
[
1
:]
self
.
static
=
[
""
,
"static"
][
"/S"
in
decl
[
2
]
]
self
.
ctype
=
decl
[
1
]
or
""
self
.
ctype
=
re
.
sub
(
r"^CvTermCriteria"
,
"TermCriteria"
,
decl
[
1
]
or
""
)
self
.
args
=
[]
arg_fix_map
=
func_arg_fix
.
get
(
classname
,
{})
.
get
(
self
.
jname
,
{})
for
a
in
decl
[
3
]:
...
...
modules/java/src/cpp/Mat.cpp
View file @
4a634696
...
...
@@ -1557,6 +1557,38 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
//
// Mat Mat::setTo(Scalar value, Mat mask = Mat())
//
JNIEXPORT
jlong
JNICALL
Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jdouble
s_val0
,
jdouble
s_val1
,
jdouble
s_val2
,
jdouble
s_val3
,
jlong
mask_nativeObj
)
{
try
{
LOGD
(
"Mat::n_1setTo__JDDDDJ()"
);
Mat
*
me
=
(
Mat
*
)
self
;
//TODO: check for NULL
Scalar
s
(
s_val0
,
s_val1
,
s_val2
,
s_val3
);
Mat
&
mask
=
*
((
Mat
*
)
mask_nativeObj
);
Mat
_retval_
=
me
->
setTo
(
s
,
mask
);
return
(
jlong
)
new
Mat
(
_retval_
);
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::n_1setTo__JDDDDJ() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::n_1setTo__JDDDDJ() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::n_1setTo__JDDDDJ()}"
);
return
0
;
}
}
//
// Mat Mat::setTo(Mat value, Mat mask = Mat())
//
...
...
@@ -1930,6 +1962,8 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1delete
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nPutD
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jdoubleArray
vals
)
{
try
{
LOGD
(
"Mat::nPutD()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
me
||
!
me
->
data
)
return
0
;
// no native object behind
if
(
me
->
rows
<=
row
||
me
->
cols
<=
col
)
return
0
;
// indexes out of range
...
...
@@ -1969,6 +2003,18 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nPutD() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nPutD() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nPutD()}"
);
return
0
;
}
}
...
...
@@ -2010,6 +2056,8 @@ extern "C" {
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nPutB
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jbyteArray
vals
)
{
try
{
LOGD
(
"Mat::nPutB()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_8U
&&
me
->
depth
()
!=
CV_8S
)
return
0
;
// incompatible type
...
...
@@ -2019,11 +2067,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
int
res
=
mat_put
<
char
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nPutB() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nPutB() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nPutB()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nPutS
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jshortArray
vals
)
{
try
{
LOGD
(
"Mat::nPutS()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_16U
&&
me
->
depth
()
!=
CV_16S
)
return
0
;
// incompatible type
...
...
@@ -2033,11 +2095,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
int
res
=
mat_put
<
short
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nPutS() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nPutS() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nPutS()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nPutI
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jintArray
vals
)
{
try
{
LOGD
(
"Mat::nPutI()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_32S
)
return
0
;
// incompatible type
...
...
@@ -2047,11 +2123,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
int
res
=
mat_put
<
int
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nPutI() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nPutI() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nPutI()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nPutF
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jfloatArray
vals
)
{
try
{
LOGD
(
"Mat::nPutF()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_32F
)
return
0
;
// incompatible type
...
...
@@ -2061,6 +2151,18 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
int
res
=
mat_put
<
float
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nPutF() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nPutF() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nPutF()}"
);
return
0
;
}
}
...
...
@@ -2101,6 +2203,8 @@ extern "C" {
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nGetB
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jbyteArray
vals
)
{
try
{
LOGD
(
"Mat::nGetB()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_8U
&&
me
->
depth
()
!=
CV_8S
)
return
0
;
// incompatible type
...
...
@@ -2110,11 +2214,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
int
res
=
mat_get
<
char
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGetB() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGetB() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGetB()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nGetS
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jshortArray
vals
)
{
try
{
LOGD
(
"Mat::nGetS()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_16U
&&
me
->
depth
()
!=
CV_16S
)
return
0
;
// incompatible type
...
...
@@ -2124,11 +2242,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
int
res
=
mat_get
<
short
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGetS() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGetS() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGetS()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nGetI
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jintArray
vals
)
{
try
{
LOGD
(
"Mat::nGetI()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_32S
)
return
0
;
// incompatible type
...
...
@@ -2138,11 +2270,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
int
res
=
mat_get
<
int
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGetI() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGetI() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGetI()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nGetF
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jfloatArray
vals
)
{
try
{
LOGD
(
"Mat::nGetF()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_32F
)
return
0
;
// incompatible type
...
...
@@ -2152,11 +2298,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
int
res
=
mat_get
<
float
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGetF() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGetF() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGetF()}"
);
return
0
;
}
}
JNIEXPORT
jint
JNICALL
Java_org_opencv_core_Mat_nGetD
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
,
jdoubleArray
vals
)
{
try
{
LOGD
(
"Mat::nGetD()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
depth
()
!=
CV_64F
)
return
0
;
// incompatible type
...
...
@@ -2166,11 +2326,25 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
int
res
=
mat_get
<
double
>
(
me
,
row
,
col
,
count
,
values
);
env
->
ReleasePrimitiveArrayCritical
(
vals
,
values
,
0
);
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGetD() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGetD() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGetD()}"
);
return
0
;
}
}
JNIEXPORT
jdoubleArray
JNICALL
Java_org_opencv_core_Mat_nGet
(
JNIEnv
*
env
,
jclass
cls
,
jlong
self
,
jint
row
,
jint
col
,
jint
count
)
{
try
{
LOGD
(
"Mat::nGet()"
);
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
if
(
!
self
)
return
0
;
// no native object behind
if
(
me
->
rows
<=
row
||
me
->
cols
<=
col
)
return
0
;
// indexes out of range
...
...
@@ -2191,6 +2365,18 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
env
->
SetDoubleArrayRegion
(
res
,
0
,
me
->
channels
(),
buff
);
}
return
res
;
}
catch
(
cv
::
Exception
e
)
{
LOGD
(
"Mat::nGet() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
e
.
what
());
return
0
;
}
catch
(...)
{
LOGD
(
"Mat::nGet() catched unknown exception (...)"
);
jclass
je
=
env
->
FindClass
(
"java/lang/Exception"
);
env
->
ThrowNew
(
je
,
"Unknown exception in JNI code {Mat::nGet()}"
);
return
0
;
}
}
JNIEXPORT
jstring
JNICALL
Java_org_opencv_core_Mat_nDump
...
...
modules/java/src/cpp/core_manual.hpp
0 → 100644
View file @
4a634696
#pragma once
#include "opencv2/core/core.hpp"
#if 0
namespace cv
{
CV_EXPORTS_W void add(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1);
CV_EXPORTS_W void subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1);
CV_EXPORTS_W void multiply(InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1);
CV_EXPORTS_W void divide(InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1);
CV_EXPORTS_W void absdiff(InputArray src1, Scalar src2, OutputArray dst);
CV_EXPORTS_W void compare(InputArray src1, Scalar src2, OutputArray dst, int cmpop);
CV_EXPORTS_W void min(InputArray src1, Scalar src2, OutputArray dst);
CV_EXPORTS_W void max(InputArray src1, Scalar src2, OutputArray dst);
}
#endif //0
modules/java/src/java/core+Mat.java
View file @
4a634696
...
...
@@ -718,6 +718,19 @@ public class Mat {
return
retVal
;
}
//
// C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
//
// javadoc: Mat::setTo(value, mask)
public
Mat
setTo
(
Scalar
value
,
Mat
mask
)
{
Mat
retVal
=
new
Mat
(
n_setTo
(
nativeObj
,
value
.
val
[
0
],
value
.
val
[
1
],
value
.
val
[
2
],
value
.
val
[
3
],
mask
.
nativeObj
));
return
retVal
;
}
//
// C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
//
...
...
@@ -1228,6 +1241,9 @@ public class Mat {
// C++: Mat Mat::operator =(Scalar s)
private
static
native
long
n_setTo
(
long
nativeObj
,
double
s_val0
,
double
s_val1
,
double
s_val2
,
double
s_val3
);
// C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
private
static
native
long
n_setTo
(
long
nativeObj
,
double
s_val0
,
double
s_val1
,
double
s_val2
,
double
s_val3
,
long
mask_nativeObj
);
// C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
private
static
native
long
n_setTo
(
long
nativeObj
,
long
value_nativeObj
,
long
mask_nativeObj
);
...
...
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