Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
037d8fbd
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,发现更多精彩内容 >>
提交
037d8fbd
编写于
6月 10, 2017
作者:
A
abratchik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor OpenCV Java Wrapping
上级
515e01e6
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
1480 addition
and
661 deletion
+1480
-661
modules/calib3d/misc/java/gen_dict.json
modules/calib3d/misc/java/gen_dict.json
+42
-0
modules/core/misc/java/gen_dict.json
modules/core/misc/java/gen_dict.json
+896
-0
modules/features2d/misc/java/gen_dict.json
modules/features2d/misc/java/gen_dict.json
+21
-0
modules/highgui/misc/java/gen_dict.json
modules/highgui/misc/java/gen_dict.json
+31
-0
modules/imgproc/misc/java/gen_dict.json
modules/imgproc/misc/java/gen_dict.json
+134
-0
modules/java/CMakeLists.txt
modules/java/CMakeLists.txt
+25
-6
modules/java/generator/gen_java.py
modules/java/generator/gen_java.py
+125
-639
modules/java/generator/src/cpp/common.h
modules/java/generator/src/cpp/common.h
+2
-13
modules/java/generator/src/cpp/converters.cpp
modules/java/generator/src/cpp/converters.cpp
+0
-3
modules/java/generator/src/cpp/listconverters.cpp
modules/java/generator/src/cpp/listconverters.cpp
+59
-0
modules/java/generator/src/cpp/listconverters.hpp
modules/java/generator/src/cpp/listconverters.hpp
+19
-0
modules/java/include/opencv2/java.hpp
modules/java/include/opencv2/java.hpp
+49
-0
modules/video/misc/java/gen_dict.json
modules/video/misc/java/gen_dict.json
+16
-0
modules/videoio/misc/gen_dict.json
modules/videoio/misc/gen_dict.json
+61
-0
未找到文件。
modules/calib3d/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"class_ignore_list"
:
[
"CirclesGridFinderParameters"
],
"missing_consts"
:
{
"Calib3d"
:
{
"public"
:
[
[
"CALIB_USE_INTRINSIC_GUESS"
,
"1"
],
[
"CALIB_RECOMPUTE_EXTRINSIC"
,
"2"
],
[
"CALIB_CHECK_COND"
,
"4"
],
[
"CALIB_FIX_SKEW"
,
"8"
],
[
"CALIB_FIX_K1"
,
"16"
],
[
"CALIB_FIX_K2"
,
"32"
],
[
"CALIB_FIX_K3"
,
"64"
],
[
"CALIB_FIX_K4"
,
"128"
],
[
"CALIB_FIX_INTRINSIC"
,
"256"
]
]
}
},
"func_arg_fix"
:
{
"findFundamentalMat"
:
{
"points1"
:
{
"ctype"
:
"vector_Point2f"
},
"points2"
:
{
"ctype"
:
"vector_Point2f"
}
},
"cornerSubPix"
:
{
"corners"
:
{
"ctype"
:
"vector_Point2f"
}
},
"findHomography"
:
{
"srcPoints"
:
{
"ctype"
:
"vector_Point2f"
},
"dstPoints"
:
{
"ctype"
:
"vector_Point2f"
}
},
"solvePnP"
:
{
"objectPoints"
:
{
"ctype"
:
"vector_Point3f"
},
"imagePoints"
:
{
"ctype"
:
"vector_Point2f"
},
"distCoeffs"
:
{
"ctype"
:
"vector_double"
}
},
"solvePnPRansac"
:
{
"objectPoints"
:
{
"ctype"
:
"vector_Point3f"
},
"imagePoints"
:
{
"ctype"
:
"vector_Point2f"
},
"distCoeffs"
:
{
"ctype"
:
"vector_double"
}
},
"undistortPoints"
:
{
"src"
:
{
"ctype"
:
"vector_Point2f"
},
"dst"
:
{
"ctype"
:
"vector_Point2f"
}
},
"projectPoints"
:
{
"objectPoints"
:
{
"ctype"
:
"vector_Point3f"
},
"imagePoints"
:
{
"ctype"
:
"vector_Point2f"
},
"distCoeffs"
:
{
"ctype"
:
"vector_double"
}
},
"initCameraMatrix2D"
:
{
"objectPoints"
:
{
"ctype"
:
"vector_vector_Point3f"
},
"imagePoints"
:
{
"ctype"
:
"vector_vector_Point2f"
}
},
"findChessboardCorners"
:
{
"corners"
:
{
"ctype"
:
"vector_Point2f"
}
},
"drawChessboardCorners"
:
{
"corners"
:
{
"ctype"
:
"vector_Point2f"
}
}
}
}
modules/core/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
此差异已折叠。
点击以展开。
modules/features2d/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"class_ignore_list"
:
[
"SimpleBlobDetector"
],
"const_private_list"
:
[
"OPPONENTEXTRACTOR"
,
"GRIDDETECTOR"
,
"PYRAMIDDETECTOR"
,
"DYNAMICDETECTOR"
],
"type_dict"
:
{
"Feature2D"
:
{
"j_type"
:
"Feature2D"
,
"jn_type"
:
"long"
,
"jni_type"
:
"jlong"
,
"jni_var"
:
"Feature2D %(n)s"
,
"suffix"
:
"J"
,
"j_import"
:
"org.opencv.features2d.Feature2D"
}
}
}
modules/highgui/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"const_ignore_list"
:
[
"EVENT_.*"
,
"WINDOW_AUTOSIZE"
,
"CV_WND_PROP_"
,
"CV_WINDOW_"
,
"CV_EVENT_"
,
"CV_GUI_"
,
"CV_PUSH_BUTTON"
,
"CV_CHECKBOX"
,
"CV_RADIOBOX"
,
"WINDOW_.+"
,
"WND_PROP_.+"
],
"ManualFuncs"
:
{
"Highgui"
:
{
"namedWindow"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"destroyWindow"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"destroyAllWindows"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"startWindowThread"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"setWindowProperty"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"getWindowProperty"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"getTrackbarPos"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"setTrackbarPos"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"imshow"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"waitKey"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"moveWindow"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
},
"resizeWindow"
:
{
"j_code"
:
[
""
],
"jn_code"
:
[
""
],
"cpp_code"
:
[
""
]
}
}
}
}
modules/imgproc/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"const_ignore_list"
:
[
"CV_TM_.+"
,
"CV_COLORCVT_MAX"
,
"CV_.*Bayer.*"
,
"CV_YUV420(i|sp|p)2.+"
,
"CV_L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV)
\\
d*2L?(BGRA?|RGBA?|GRAY|XYZ|YCrCb|Luv|Lab|HLS|YUV|HSV).*"
,
"CV_FLOODFILL_.+"
,
"CV_ADAPTIVE_THRESH_.+"
],
"const_private_list"
:
[
"CV_MOP_.+"
,
"CV_INTER_.+"
,
"CV_THRESH_.+"
,
"CV_INPAINT_.+"
,
"CV_RETR_.+"
,
"CV_CHAIN_APPROX_.+"
],
"missing_consts"
:
{
"Imgproc"
:
{
"private"
:
[
[
"IPL_BORDER_CONSTANT"
,
0
],
[
"IPL_BORDER_REPLICATE"
,
1
],
[
"IPL_BORDER_REFLECT"
,
2
],
[
"IPL_BORDER_WRAP"
,
3
],
[
"IPL_BORDER_REFLECT_101"
,
4
],
[
"IPL_BORDER_TRANSPARENT"
,
5
]
],
"public"
:
[
[
"LINE_AA"
,
16
],
[
"LINE_8"
,
8
],
[
"LINE_4"
,
4
]
]
}
},
"ManualFuncs"
:
{
"Imgproc"
:
{
"getTextSize"
:
{
"j_code"
:
[
"
\n
"
,
"// C++: Size getTextSize(const String& 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)"
,
" throw new java.lang.IllegalArgumentException(
\"
'baseLine' must be 'int[1]' or 'null'.
\"
);"
,
" Size retVal = new Size(n_getTextSize(text, fontFace, fontScale, thickness, baseLine));"
,
" return retVal;"
,
"}"
,
"
\n
"
],
"jn_code"
:
[
"private static native double[] n_getTextSize(String text, int fontFace, double fontScale, int thickness, int[] baseLine);
\n
"
],
"cpp_code"
:
[
"
\n
"
,
" // C++: Size getTextSize(const String& text, int fontFace, double fontScale, int thickness, int* baseLine);"
,
" JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize (JNIEnv*, jclass, jstring, jint, jdouble, jint, jintArray);"
,
"
\n
"
,
" JNIEXPORT jdoubleArray JNICALL Java_org_opencv_imgproc_Imgproc_n_1getTextSize"
,
" (JNIEnv* env, jclass, jstring text, jint fontFace, jdouble fontScale, jint thickness, jintArray baseLine)"
,
" {"
,
" try {"
,
" LOGD(
\"
Core::n_1getTextSize()
\"
);"
,
" jdoubleArray result;"
,
" result = env->NewDoubleArray(2);"
,
" if (result == NULL) {"
,
" return NULL; /* out of memory error thrown */"
,
" }"
,
"
\n
"
,
" const char* utf_text = env->GetStringUTFChars(text, 0);"
,
" String n_text( utf_text ? utf_text :
\"\"
);"
,
" env->ReleaseStringUTFChars(text, utf_text);"
,
"
\n
"
,
" int _baseLine;"
,
" int* pbaseLine = 0;"
,
"
\n
"
,
" if (baseLine != NULL)"
,
" pbaseLine = &_baseLine;"
,
"
\n
"
,
" cv::Size rsize = cv::getTextSize(n_text, (int)fontFace, (double)fontScale, (int)thickness, pbaseLine);"
,
"
\n
"
,
" jdouble fill[2];"
,
" fill[0]=rsize.width;"
,
" fill[1]=rsize.height;"
,
"
\n
"
,
" env->SetDoubleArrayRegion(result, 0, 2, fill);"
,
"
\n
"
,
" if (baseLine != NULL) {"
,
" jint jbaseLine = (jint)(*pbaseLine);"
,
" env->SetIntArrayRegion(baseLine, 0, 1, &jbaseLine);"
,
" }"
,
"
\n
"
,
" return result;"
,
"
\n
"
,
" } catch(const cv::Exception& e) {"
,
" LOGD(
\"
Imgproc::n_1getTextSize() 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 NULL;"
,
" } catch (...) {"
,
" LOGD(
\"
Imgproc::n_1getTextSize() catched unknown exception (...)
\"
);"
,
" jclass je = env->FindClass(
\"
java/lang/Exception
\"
);"
,
" env->ThrowNew(je,
\"
Unknown exception in JNI code {core::getTextSize()}
\"
);"
,
" return NULL;"
,
" }"
,
" }"
]
}
}
},
"func_arg_fix"
:
{
"goodFeaturesToTrack"
:
{
"corners"
:
{
"ctype"
:
"vector_Point"
}
},
"minEnclosingCircle"
:
{
"points"
:
{
"ctype"
:
"vector_Point2f"
}
},
"fitEllipse"
:
{
"points"
:
{
"ctype"
:
"vector_Point2f"
}
},
"fillPoly"
:
{
"pts"
:
{
"ctype"
:
"vector_vector_Point"
}
},
"polylines"
:
{
"pts"
:
{
"ctype"
:
"vector_vector_Point"
}
},
"fillConvexPoly"
:
{
"points"
:
{
"ctype"
:
"vector_Point"
}
},
"approxPolyDP"
:
{
"curve"
:
{
"ctype"
:
"vector_Point2f"
},
"approxCurve"
:
{
"ctype"
:
"vector_Point2f"
}
},
"arcLength"
:
{
"curve"
:
{
"ctype"
:
"vector_Point2f"
}
},
"pointPolygonTest"
:
{
"contour"
:
{
"ctype"
:
"vector_Point2f"
}
},
"minAreaRect"
:
{
"points"
:
{
"ctype"
:
"vector_Point2f"
}
},
"getAffineTransform"
:
{
"src"
:
{
"ctype"
:
"vector_Point2f"
},
"dst"
:
{
"ctype"
:
"vector_Point2f"
}
},
"drawContours"
:
{
"contours"
:
{
"ctype"
:
"vector_vector_Point"
}
},
"findContours"
:
{
"contours"
:
{
"ctype"
:
"vector_vector_Point"
}
},
"convexityDefects"
:
{
"contour"
:
{
"ctype"
:
"vector_Point"
},
"convexhull"
:
{
"ctype"
:
"vector_int"
},
"convexityDefects"
:
{
"ctype"
:
"vector_Vec4i"
}
},
"isContourConvex"
:
{
"contour"
:
{
"ctype"
:
"vector_Point"
}
},
"convexHull"
:
{
"points"
:
{
"ctype"
:
"vector_Point"
},
"hull"
:
{
"ctype"
:
"vector_int"
},
"returnPoints"
:
{
"ctype"
:
""
}
}
}
}
modules/java/CMakeLists.txt
浏览文件 @
037d8fbd
...
...
@@ -140,10 +140,17 @@ glob_more_specific_sources(AIDL "${CMAKE_CURRENT_SOURCE_DIR}/generator" handwrit
# headers of OpenCV modules
set
(
opencv_public_headers
""
)
set
(
opencv_type_dicts
""
)
set
(
generated_cpp_sources
""
)
set
(
generated_java_sources
""
)
foreach
(
module
${
OPENCV_JAVA_MODULES
}
)
set
(
module_java_dir
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/misc/java"
)
# custom mappings between c and java/JNI types
set
(
custom_type_dict
"
${
module_java_dir
}
/gen_dict.json"
)
if
(
EXISTS
"
${
custom_type_dict
}
"
)
list
(
APPEND opencv_java_type_dict_
${
module
}
${
custom_type_dict
}
)
endif
()
set
(
custom_header_list
"
${
module_java_dir
}
/filelist"
)
if
(
EXISTS
"
${
custom_header_list
}
"
)
file
(
STRINGS
"
${
custom_header_list
}
"
module_headers
)
...
...
@@ -171,6 +178,13 @@ foreach(module ${OPENCV_JAVA_MODULES})
include_directories
(
"
${
module_java_dir
}
/src/cpp"
)
set
(
common_header_list
"
${
module_java_dir
}
/filelist_common"
)
if
(
EXISTS
"
${
common_header_list
}
"
)
file
(
STRINGS
"
${
common_header_list
}
"
__headers
)
ocv_list_add_prefix
(
__headers
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/"
)
list
(
APPEND opencv_java_common_headers_
${
module
}
${
__headers
}
)
endif
()
foreach
(
m
${
OPENCV_MODULE_opencv_
${
module
}
_DEPS
}
)
set
(
common_header_list
"
${
OPENCV_MODULE_
${
m
}
_LOCATION
}
/misc/java/filelist_common"
)
if
(
EXISTS
"
${
common_header_list
}
"
)
...
...
@@ -178,6 +192,11 @@ foreach(module ${OPENCV_JAVA_MODULES})
ocv_list_add_prefix
(
__headers
"
${
OPENCV_MODULE_
${
m
}
_LOCATION
}
/"
)
list
(
APPEND opencv_java_common_headers_
${
module
}
${
__headers
}
)
endif
()
set
(
custom_type_dict
"
${
OPENCV_MODULE_
${
m
}
_LOCATION
}
/misc/java/gen_dict.json"
)
if
(
EXISTS
"
${
custom_type_dict
}
"
)
list
(
APPEND opencv_java_type_dict_
${
module
}
${
custom_type_dict
}
)
list
(
APPEND opencv_type_dicts
${
custom_type_dicts
}
)
endif
()
endforeach
()
glob_more_specific_sources
(
H
"
${
module_java_dir
}
"
handwritten_h_sources
)
...
...
@@ -188,7 +207,7 @@ foreach(module ${OPENCV_JAVA_MODULES})
# first run of gen_java.py (to get list of generated files)
file
(
REMOVE_RECURSE
"
${
probe_dir
}
"
)
file
(
MAKE_DIRECTORY
"
${
probe_dir
}
"
)
execute_process
(
COMMAND
${
PYTHON_DEFAULT_EXECUTABLE
}
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
module
}
${
opencv_public_headers_
${
module
}}
"--common"
${
opencv_java_common_headers
_
${
module
}}
execute_process
(
COMMAND
${
PYTHON_DEFAULT_EXECUTABLE
}
"
${
scripts_gen_java
}
"
"
-p"
"
${
scripts_hdr_parser
}
"
"-m"
${
module
}
"-s"
${
opencv_public_headers_
${
module
}}
"-c"
${
opencv_java_common_headers_
${
module
}}
"-t"
${
opencv_java_type_dict
_
${
module
}}
WORKING_DIRECTORY
"
${
probe_dir
}
"
OUTPUT_QUIET ERROR_QUIET
)
file
(
GLOB_RECURSE generated_java_sources_
${
module
}
RELATIVE
"
${
probe_dir
}
"
"
${
probe_dir
}
/*.java"
)
...
...
@@ -216,20 +235,20 @@ else()
endif
()
endif
()
# IMPORTANT: add dependencies to cmake (we should rerun cmake if any of these files
is
modified)
add_cmake_dependencies
(
${
scripts_gen_java
}
${
scripts_hdr_parser
}
${
opencv_public_headers
}
)
# IMPORTANT: add dependencies to cmake (we should rerun cmake if any of these files
are
modified)
add_cmake_dependencies
(
${
scripts_gen_java
}
${
scripts_hdr_parser
}
${
opencv_public_headers
}
${
opencv_type_dicts
}
)
######################################################################################################################################
# step 1: generate .cpp/.java from OpenCV headers
file
(
MAKE_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gen"
)
set
(
step1_depends
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
opencv_public_headers
}
)
set
(
step1_depends
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
opencv_public_headers
}
${
opencv_type_dicts
}
)
foreach
(
module
${
OPENCV_JAVA_MODULES
}
)
# second run of gen_java.py (at build time)
add_custom_command
(
OUTPUT
${
generated_java_sources_
${
module
}}
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gen/
${
module
}
.cpp"
COMMAND
${
PYTHON_DEFAULT_EXECUTABLE
}
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
module
}
${
opencv_public_headers_
${
module
}}
"--common"
${
opencv_java_common_headers
_
${
module
}}
COMMAND
${
PYTHON_DEFAULT_EXECUTABLE
}
"
${
scripts_gen_java
}
"
"
-p"
"
${
scripts_hdr_parser
}
"
"-m"
${
module
}
"-s"
${
opencv_public_headers_
${
module
}}
"-c"
${
opencv_java_common_headers_
${
module
}}
"-t"
${
opencv_java_type_dict
_
${
module
}}
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gen/"
DEPENDS
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
opencv_public_headers_
${
module
}}
${
opencv_java_common_headers_
${
module
}}
DEPENDS
"
${
scripts_gen_java
}
"
"
${
scripts_hdr_parser
}
"
${
opencv_public_headers_
${
module
}}
${
opencv_java_common_headers_
${
module
}}
${
opencv_java_type_dict_
${
module
}}
)
endforeach
()
...
...
modules/java/generator/gen_java.py
浏览文件 @
037d8fbd
此差异已折叠。
点击以展开。
modules/java/generator/src/cpp/common.h
浏览文件 @
037d8fbd
...
...
@@ -7,22 +7,11 @@
#endif
#include <jni.h>
#ifdef __ANDROID__
# include <android/log.h>
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
# ifdef DEBUG
# define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
# else
# define LOGD(...)
# endif
#else
# define LOGE(...)
# define LOGD(...)
#endif
#include "opencv2/java.hpp"
#include "opencv2/core/utility.hpp"
#include "converters.h"
#include "listconverters.hpp"
#ifdef _MSC_VER
# pragma warning(disable:4800 4244)
...
...
modules/java/generator/src/cpp/converters.cpp
浏览文件 @
037d8fbd
...
...
@@ -3,9 +3,6 @@
using
namespace
cv
;
#define CHECK_MAT(cond) if(!(cond)){ LOGD("FAILED: " #cond); return; }
// vector_int
void
Mat_to_vector_int
(
Mat
&
mat
,
std
::
vector
<
int
>&
v_int
)
...
...
modules/java/generator/src/cpp/listconverters.cpp
0 → 100644
浏览文件 @
037d8fbd
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// Author: abratchik
#define LOG_TAG "org.opencv.utils.Converters"
#include "common.h"
jobject
vector_String_to_List
(
JNIEnv
*
env
,
std
::
vector
<
cv
::
String
>&
vs
)
{
static
jclass
juArrayList
=
ARRAYLIST
(
env
);
static
jmethodID
m_create
=
CONSTRUCTOR
(
env
,
juArrayList
);
jmethodID
m_add
=
LIST_ADD
(
env
,
juArrayList
);
jobject
result
=
env
->
NewObject
(
juArrayList
,
m_create
,
vs
.
size
());
for
(
std
::
vector
<
cv
::
String
>::
iterator
it
=
vs
.
begin
();
it
!=
vs
.
end
();
++
it
)
{
jstring
element
=
env
->
NewStringUTF
((
*
it
).
c_str
());
env
->
CallBooleanMethod
(
result
,
m_add
,
element
);
env
->
DeleteLocalRef
(
element
);
}
return
result
;
}
std
::
vector
<
cv
::
String
>
List_to_vector_String
(
JNIEnv
*
env
,
jobject
list
)
{
static
jclass
juArrayList
=
ARRAYLIST
(
env
);
jmethodID
m_size
=
LIST_SIZE
(
env
,
juArrayList
);
jmethodID
m_get
=
LIST_GET
(
env
,
juArrayList
);
jint
len
=
env
->
CallIntMethod
(
list
,
m_size
);
std
::
vector
<
cv
::
String
>
result
;
result
.
reserve
(
len
);
for
(
jint
i
=
0
;
i
<
len
;
i
++
)
{
jstring
element
=
static_cast
<
jstring
>
(
env
->
CallObjectMethod
(
list
,
m_get
,
i
));
const
char
*
pchars
=
env
->
GetStringUTFChars
(
element
,
NULL
);
result
.
push_back
(
pchars
);
env
->
ReleaseStringUTFChars
(
element
,
pchars
);
env
->
DeleteLocalRef
(
element
);
}
return
result
;
}
void
Copy_vector_String_to_List
(
JNIEnv
*
env
,
std
::
vector
<
cv
::
String
>&
vs
,
jobject
list
)
{
static
jclass
juArrayList
=
ARRAYLIST
(
env
);
jmethodID
m_clear
=
LIST_CLEAR
(
env
,
juArrayList
);
jmethodID
m_add
=
LIST_ADD
(
env
,
juArrayList
);
env
->
CallVoidMethod
(
list
,
m_clear
);
for
(
std
::
vector
<
cv
::
String
>::
iterator
it
=
vs
.
begin
();
it
!=
vs
.
end
();
++
it
)
{
jstring
element
=
env
->
NewStringUTF
((
*
it
).
c_str
());
env
->
CallBooleanMethod
(
list
,
m_add
,
element
);
env
->
DeleteLocalRef
(
element
);
}
}
\ No newline at end of file
modules/java/generator/src/cpp/listconverters.hpp
0 → 100644
浏览文件 @
037d8fbd
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// Author: abratchik
#ifndef LISTCONVERTERS_HPP
#define LISTCONVERTERS_HPP
#include "opencv2/opencv_modules.hpp"
#include "opencv2/core.hpp"
jobject
vector_String_to_List
(
JNIEnv
*
env
,
std
::
vector
<
cv
::
String
>&
vs
);
std
::
vector
<
cv
::
String
>
List_to_vector_String
(
JNIEnv
*
env
,
jobject
list
);
void
Copy_vector_String_to_List
(
JNIEnv
*
env
,
std
::
vector
<
cv
::
String
>&
vs
,
jobject
list
);
#endif
/* LISTCONVERTERS_HPP */
\ No newline at end of file
modules/java/include/opencv2/java.hpp
0 → 100644
浏览文件 @
037d8fbd
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html
// Author: abratchik
#ifndef JAVA_HPP
#define JAVA_HPP
#ifdef __ANDROID__
# include <android/log.h>
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
# ifdef DEBUG
# define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
# else
# define LOGD(...)
# endif
#else
# define LOGE(...)
# define LOGD(...)
#endif
#define MATOFINT(ENV) static_cast<jclass>(ENV->NewGlobalRef(ENV->FindClass("org/opencv/core/MatOfInt")))
#define GETNATIVEOBJ(ENV, CLS, MAT) ENV->GetLongField(MAT, ENV->GetFieldID(CLS, "nativeObj", "J"))
#define CONSTRUCTOR(ENV, CLS) ENV->GetMethodID(CLS, "<init>", "(I)V")
#define ARRAYLIST(ENV) static_cast<jclass>(ENV->NewGlobalRef(ENV->FindClass("java/util/ArrayList")))
#define LIST_ADD(ENV, LIST) ENV->GetMethodID(LIST, "add", "(Ljava/lang/Object;)Z")
#define LIST_GET(ENV, LIST) ENV->GetMethodID(LIST, "get", "((I)Ljava/lang/Object;")
#define LIST_SIZE(ENV, LIST) ENV->GetMethodID(LIST, "size", "()I")
#define LIST_CLEAR(ENV, LIST) ENV->GetMethodID(LIST, "clear", "()V")
#define CHECK_MAT(cond) if(!(cond)){ LOGD("FAILED: " #cond); return; }
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/* JAVA_HPP */
\ No newline at end of file
modules/video/misc/java/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"missing_consts"
:
{
"Video"
:
{
"private"
:
[
[
"CV_LKFLOW_INITIAL_GUESSES"
,
4
],
[
"CV_LKFLOW_GET_MIN_EIGENVALS"
,
8
]
]
}
},
"func_arg_fix"
:
{
"calcOpticalFlowPyrLK"
:
{
"prevPts"
:
{
"ctype"
:
"vector_Point2f"
},
"nextPts"
:
{
"ctype"
:
"vector_Point2f"
},
"status"
:
{
"ctype"
:
"vector_uchar"
},
"err"
:
{
"ctype"
:
"vector_float"
}
}
}
}
modules/videoio/misc/gen_dict.json
0 → 100644
浏览文件 @
037d8fbd
{
"const_ignore_list"
:
[
"CV_CAP_OPENNI"
,
"CV_CAP_PROP_OPENNI_"
,
"CV_CAP_INTELPERC"
,
"CV_CAP_PROP_INTELPERC_"
,
"CV_CAP_ANY"
,
"CV_CAP_MIL"
,
"CV_CAP_VFW"
,
"CV_CAP_V4L"
,
"CV_CAP_V4L2"
,
"CV_CAP_FIREWARE"
,
"CV_CAP_FIREWIRE"
,
"CV_CAP_IEEE1394"
,
"CV_CAP_DC1394"
,
"CV_CAP_CMU1394"
,
"CV_CAP_STEREO"
,
"CV_CAP_TYZX"
,
"CV_CAP_QT"
,
"CV_CAP_UNICAP"
,
"CV_CAP_DSHOW"
,
"CV_CAP_PVAPI"
,
"CV_CAP_PROP_DC1394_OFF"
,
"CV_CAP_PROP_DC1394_MODE_MANUAL"
,
"CV_CAP_PROP_DC1394_MODE_AUTO"
,
"CV_CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO"
,
"CV_CAP_PROP_POS_MSEC"
,
"CV_CAP_PROP_POS_FRAMES"
,
"CV_CAP_PROP_POS_AVI_RATIO"
,
"CV_CAP_PROP_FPS"
,
"CV_CAP_PROP_FOURCC"
,
"CV_CAP_PROP_FRAME_COUNT"
,
"CV_CAP_PROP_FORMAT"
,
"CV_CAP_PROP_MODE"
,
"CV_CAP_PROP_BRIGHTNESS"
,
"CV_CAP_PROP_CONTRAST"
,
"CV_CAP_PROP_SATURATION"
,
"CV_CAP_PROP_HUE"
,
"CV_CAP_PROP_GAIN"
,
"CV_CAP_PROP_EXPOSURE"
,
"CV_CAP_PROP_CONVERT_RGB"
,
"CV_CAP_PROP_WHITE_BALANCE_BLUE_U"
,
"CV_CAP_PROP_RECTIFICATION"
,
"CV_CAP_PROP_MONOCHROME"
,
"CV_CAP_PROP_SHARPNESS"
,
"CV_CAP_PROP_AUTO_EXPOSURE"
,
"CV_CAP_PROP_GAMMA"
,
"CV_CAP_PROP_TEMPERATURE"
,
"CV_CAP_PROP_TRIGGER"
,
"CV_CAP_PROP_TRIGGER_DELAY"
,
"CV_CAP_PROP_WHITE_BALANCE_RED_V"
,
"CV_CAP_PROP_MAX_DC1394"
,
"CV_CAP_GSTREAMER_QUEUE_LENGTH"
,
"CV_CAP_PROP_PVAPI_MULTICASTIP"
,
"CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING"
,
"CV_TYZX_LEFT"
,
"CV_TYZX_RIGHT"
,
"CV_TYZX_COLOR"
,
"CV_TYZX_Z"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录