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
688d170d
Commit
688d170d
authored
Mar 20, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java wrapper is adapted for cv::String
parent
707d3e0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
38 deletions
+40
-38
CMakeLists.txt
modules/java/CMakeLists.txt
+2
-0
gen_java.py
modules/java/generator/gen_java.py
+9
-9
features2d_manual.hpp
modules/java/generator/src/cpp/features2d_manual.hpp
+29
-29
No files found.
modules/java/CMakeLists.txt
View file @
688d170d
...
...
@@ -272,6 +272,8 @@ endif(ANDROID)
add_library
(
${
the_module
}
SHARED
${
handwrittren_h_sources
}
${
handwrittren_cpp_sources
}
${
generated_cpp_sources
}
${
copied_files
}
"
${
JAR_FILE
}
"
"
${
JAR_FILE
}
.dephelper"
)
set_target_properties
(
${
the_module
}
PROPERTIES COMPILE_DEFINITIONS OPENCV_NOSTL
)
if
(
BUILD_FAT_JAVA_LIB
)
set
(
__deps
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_MODULES_BUILD
}
)
list
(
REMOVE_ITEM __deps
${
the_module
}
opencv_ts
)
...
...
modules/java/generator/gen_java.py
View file @
688d170d
...
...
@@ -285,13 +285,13 @@ type_dict = {
"CvSlice"
:
{
"j_type"
:
"Range"
,
"jn_args"
:
((
"int"
,
".start"
),
(
"int"
,
".end"
)),
"jni_var"
:
"Range
%(n)
s(
%(n)
s_start,
%(n)
s_end)"
,
"jni_type"
:
"jdoubleArray"
,
"suffix"
:
"II"
},
"
s
tring"
:
{
"j_type"
:
"String"
,
"jn_type"
:
"String"
,
"
S
tring"
:
{
"j_type"
:
"String"
,
"jn_type"
:
"String"
,
"jni_type"
:
"jstring"
,
"jni_name"
:
"n_
%(n)
s"
,
"jni_var"
:
'const char* utf_
%(n)
s = env->GetStringUTFChars(
%(n)
s, 0);
std::s
tring n_
%(n)
s( utf_
%(n)
s ? utf_
%(n)
s : "" ); env->ReleaseStringUTFChars(
%(n)
s, utf_
%(n)
s)'
,
"jni_var"
:
'const char* utf_
%(n)
s = env->GetStringUTFChars(
%(n)
s, 0);
cv::S
tring n_
%(n)
s( utf_
%(n)
s ? utf_
%(n)
s : "" ); env->ReleaseStringUTFChars(
%(n)
s, utf_
%(n)
s)'
,
"suffix"
:
"Ljava_lang_String_2"
},
"c_string"
:
{
"j_type"
:
"String"
,
"jn_type"
:
"String"
,
"jni_type"
:
"jstring"
,
"jni_name"
:
"n_
%(n)
s.c_str()"
,
"jni_var"
:
'const char* utf_
%(n)
s = env->GetStringUTFChars(
%(n)
s, 0);
std::s
tring n_
%(n)
s( utf_
%(n)
s ? utf_
%(n)
s : "" ); env->ReleaseStringUTFChars(
%(n)
s, utf_
%(n)
s)'
,
"jni_var"
:
'const char* utf_
%(n)
s = env->GetStringUTFChars(
%(n)
s, 0);
cv::S
tring 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_type"
:
"jdoubleArray"
,
...
...
@@ -417,7 +417,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
{
'j_code'
:
"""
// C++: Size getTextSize(const
std::s
tring& text, int fontFace, double fontScale, int thickness, int* baseLine);
// C++: Size getTextSize(const
cv::S
tring& text, int fontFace, double fontScale, int thickness, int* baseLine);
//javadoc:getTextSize(text, fontFace, fontScale, thickness, baseLine)
public static Size getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine) {
if(baseLine != null && baseLine.length != 1)
...
...
@@ -430,7 +430,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
""" private static native double[] n_getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine);
\n
"""
,
'cpp_code'
:
"""
// C++: Size getTextSize(const
std::s
tring& text, int fontFace, double fontScale, int thickness, int* baseLine);
// C++: Size getTextSize(const
cv::S
tring& text, int fontFace, double fontScale, int thickness, int* baseLine);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
...
...
@@ -445,7 +445,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
}
const char* utf_text = env->GetStringUTFChars(text, 0);
std::s
tring n_text( utf_text ? utf_text : "" );
cv::S
tring n_text( utf_text ? utf_text : "" );
env->ReleaseStringUTFChars(text, utf_text);
int _baseLine;
...
...
@@ -1196,7 +1196,7 @@ extern "C" {
ret
=
"return (jlong) _retval_;"
elif
fi
.
ctype
.
startswith
(
'vector'
):
# c-tor
ret
=
"return (jlong) _retval_;"
elif
fi
.
ctype
==
"
s
tring"
:
elif
fi
.
ctype
==
"
S
tring"
:
ret
=
"return env->NewStringUTF(_retval_.c_str());"
default
=
'return env->NewStringUTF("");'
elif
fi
.
ctype
in
self
.
classes
:
# wrapped class:
...
...
@@ -1218,8 +1218,8 @@ extern "C" {
retval
=
fi
.
ctype
+
" _retval_ = "
if
fi
.
ctype
==
"void"
:
retval
=
""
elif
fi
.
ctype
==
"
s
tring"
:
retval
=
"
std
::"
+
retval
elif
fi
.
ctype
==
"
S
tring"
:
retval
=
"
cv
::"
+
retval
elif
fi
.
ctype
.
startswith
(
'vector'
):
retval
=
type_dict
[
fi
.
ctype
][
'jni_var'
]
%
{
"n"
:
'_ret_val_vector_'
}
+
" = "
c_epilogue
.
append
(
"Mat* _retval_ = new Mat();"
)
...
...
modules/java/generator/src/cpp/features2d_manual.hpp
View file @
688d170d
...
...
@@ -84,7 +84,7 @@ public:
//not supported: SimpleBlob, Dense
CV_WRAP
static
javaFeatureDetector
*
create
(
int
detectorType
)
{
std
::
s
tring
name
;
cv
::
S
tring
name
;
if
(
detectorType
>
DYNAMICDETECTOR
)
{
name
=
"Dynamic"
;
...
...
@@ -104,37 +104,37 @@ public:
switch
(
detectorType
)
{
case
FAST
:
name
+=
"FAST"
;
name
=
name
+
"FAST"
;
break
;
case
STAR
:
name
+=
"STAR"
;
name
=
name
+
"STAR"
;
break
;
case
SIFT
:
name
+=
"SIFT"
;
name
=
name
+
"SIFT"
;
break
;
case
SURF
:
name
+=
"SURF"
;
name
=
name
+
"SURF"
;
break
;
case
ORB
:
name
+=
"ORB"
;
name
=
name
+
"ORB"
;
break
;
case
MSER
:
name
+=
"MSER"
;
name
=
name
+
"MSER"
;
break
;
case
GFTT
:
name
+=
"GFTT"
;
name
=
name
+
"GFTT"
;
break
;
case
HARRIS
:
name
+=
"HARRIS"
;
name
=
name
+
"HARRIS"
;
break
;
case
SIMPLEBLOB
:
name
+=
"SimpleBlob"
;
name
=
name
+
"SimpleBlob"
;
break
;
case
DENSE
:
name
+=
"Dense"
;
name
=
name
+
"Dense"
;
break
;
case
BRISK
:
name
+=
"BRISK"
;
name
=
name
+
"BRISK"
;
break
;
default:
CV_Error
(
CV_StsBadArg
,
"Specified feature detector type is not supported."
);
...
...
@@ -146,14 +146,14 @@ public:
return
(
javaFeatureDetector
*
)((
FeatureDetector
*
)
detector
);
}
CV_WRAP
void
write
(
const
std
::
s
tring
&
fileName
)
const
CV_WRAP
void
write
(
const
cv
::
S
tring
&
fileName
)
const
{
FileStorage
fs
(
fileName
,
FileStorage
::
WRITE
);
((
FeatureDetector
*
)
this
)
->
write
(
fs
);
fs
.
release
();
}
CV_WRAP
void
read
(
const
std
::
s
tring
&
fileName
)
CV_WRAP
void
read
(
const
cv
::
S
tring
&
fileName
)
{
FileStorage
fs
(
fileName
,
FileStorage
::
READ
);
((
FeatureDetector
*
)
this
)
->
read
(
fs
.
root
());
...
...
@@ -208,7 +208,7 @@ public:
//supported: FlannBased, BruteForce, BruteForce-L1, BruteForce-Hamming, BruteForce-HammingLUT
CV_WRAP
static
javaDescriptorMatcher
*
create
(
int
matcherType
)
{
std
::
s
tring
name
;
cv
::
S
tring
name
;
switch
(
matcherType
)
{
...
...
@@ -240,14 +240,14 @@ public:
return
(
javaDescriptorMatcher
*
)((
DescriptorMatcher
*
)
matcher
);
}
CV_WRAP
void
write
(
const
std
::
s
tring
&
fileName
)
const
CV_WRAP
void
write
(
const
cv
::
S
tring
&
fileName
)
const
{
FileStorage
fs
(
fileName
,
FileStorage
::
WRITE
);
((
DescriptorMatcher
*
)
this
)
->
write
(
fs
);
fs
.
release
();
}
CV_WRAP
void
read
(
const
std
::
s
tring
&
fileName
)
CV_WRAP
void
read
(
const
cv
::
S
tring
&
fileName
)
{
FileStorage
fs
(
fileName
,
FileStorage
::
READ
);
((
DescriptorMatcher
*
)
this
)
->
read
(
fs
.
root
());
...
...
@@ -294,7 +294,7 @@ public:
//not supported: Calonder
CV_WRAP
static
javaDescriptorExtractor
*
create
(
int
extractorType
)
{
std
::
s
tring
name
;
cv
::
S
tring
name
;
if
(
extractorType
>
OPPONENTEXTRACTOR
)
{
...
...
@@ -305,22 +305,22 @@ public:
switch
(
extractorType
)
{
case
SIFT
:
name
+=
"SIFT"
;
name
=
name
+
"SIFT"
;
break
;
case
SURF
:
name
+=
"SURF"
;
name
=
name
+
"SURF"
;
break
;
case
ORB
:
name
+=
"ORB"
;
name
=
name
+
"ORB"
;
break
;
case
BRIEF
:
name
+=
"BRIEF"
;
name
=
name
+
"BRIEF"
;
break
;
case
BRISK
:
name
+=
"BRISK"
;
name
=
name
+
"BRISK"
;
break
;
case
FREAK
:
name
+=
"FREAK"
;
name
=
name
+
"FREAK"
;
break
;
default:
CV_Error
(
CV_StsBadArg
,
"Specified descriptor extractor type is not supported."
);
...
...
@@ -332,14 +332,14 @@ public:
return
(
javaDescriptorExtractor
*
)((
DescriptorExtractor
*
)
extractor
);
}
CV_WRAP
void
write
(
const
std
::
s
tring
&
fileName
)
const
CV_WRAP
void
write
(
const
cv
::
S
tring
&
fileName
)
const
{
FileStorage
fs
(
fileName
,
FileStorage
::
WRITE
);
((
DescriptorExtractor
*
)
this
)
->
write
(
fs
);
fs
.
release
();
}
CV_WRAP
void
read
(
const
std
::
s
tring
&
fileName
)
CV_WRAP
void
read
(
const
cv
::
S
tring
&
fileName
)
{
FileStorage
fs
(
fileName
,
FileStorage
::
READ
);
((
DescriptorExtractor
*
)
this
)
->
read
(
fs
.
root
());
...
...
@@ -401,7 +401,7 @@ public:
//unsupported: Vector
CV_WRAP
static
javaGenericDescriptorMatcher
*
create
(
int
matcherType
)
{
std
::
s
tring
name
;
cv
::
S
tring
name
;
switch
(
matcherType
)
{
...
...
@@ -421,14 +421,14 @@ public:
return
(
javaGenericDescriptorMatcher
*
)((
GenericDescriptorMatcher
*
)
matcher
);
}
CV_WRAP
void
write
(
const
std
::
s
tring
&
fileName
)
const
CV_WRAP
void
write
(
const
cv
::
S
tring
&
fileName
)
const
{
FileStorage
fs
(
fileName
,
FileStorage
::
WRITE
);
((
GenericDescriptorMatcher
*
)
this
)
->
write
(
fs
);
fs
.
release
();
}
CV_WRAP
void
read
(
const
std
::
s
tring
&
fileName
)
CV_WRAP
void
read
(
const
cv
::
S
tring
&
fileName
)
{
FileStorage
fs
(
fileName
,
FileStorage
::
READ
);
((
GenericDescriptorMatcher
*
)
this
)
->
read
(
fs
.
root
());
...
...
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