Added Java packages support to cmake
This commit is contained in:
parent
070579d9c3
commit
dfdb15be79
@ -16,6 +16,18 @@ SET(RST_PARSER "${CMAKE_CURRENT_SOURCE_DIR}/rst_parser.py")
|
||||
|
||||
SET(additional_clean_files "")
|
||||
|
||||
macro(capitalize name outputvar)
|
||||
string(SUBSTRING "${name}" 0 1 first_letter)
|
||||
string(SUBSTRING "${name}" 1 -1 tail_letters)
|
||||
string(TOUPPER "${first_letter}" first_letter)
|
||||
SET(${outputvar} "${first_letter}${tail_letters}")
|
||||
endmacro()
|
||||
|
||||
#cleanup
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove *.java *.cpp *.h *.txt
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
foreach(module ${OPENCV_JAVA_MODULES})
|
||||
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/config/${module}.filelist")
|
||||
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/config/${module}.filelist" headers_to_parse)
|
||||
@ -31,8 +43,16 @@ foreach(module ${OPENCV_JAVA_MODULES})
|
||||
list(SORT module_cppheaders)
|
||||
ENDIF()
|
||||
|
||||
# first run =(
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_cheaders} ${module_cppheaders}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
OUTPUT_QUIET ERROR_QUIET)
|
||||
|
||||
FILE(GLOB ${module}_generated_java_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}+*.java")
|
||||
|
||||
# second run =(
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}.java"
|
||||
OUTPUT ${${module}_generated_java_sources}
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp"
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${GEN_JAVA}" "${HDR_PARSER}" ${module} ${module_cheaders} ${module_cppheaders}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
@ -52,7 +72,7 @@ SET (dependent_extra_libs "")
|
||||
|
||||
foreach(module ${OPENCV_JAVA_MODULES})
|
||||
LIST(APPEND generated_cpp_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}.cpp")
|
||||
LIST(APPEND generated_java_sources "${CMAKE_CURRENT_BINARY_DIR}/${module}.java")
|
||||
LIST(APPEND generated_java_sources ${${module}_generated_java_sources})
|
||||
LIST(APPEND dependent_libs opencv_${module})
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../${module}/include")
|
||||
endforeach()
|
||||
@ -136,7 +156,9 @@ FILE(GLOB java_project_files "${CMAKE_CURRENT_SOURCE_DIR}/src/java/*.java")
|
||||
SET(documented_java_files)
|
||||
foreach(java_file ${java_project_files} ${generated_java_sources})
|
||||
get_filename_component(java_file_name "${java_file}" NAME_WE)
|
||||
list(APPEND documented_java_files "${CMAKE_CURRENT_BINARY_DIR}/${java_file_name}-jdoc.java")
|
||||
if (NOT java_file_name MATCHES ".*-jdoc$")
|
||||
list(APPEND documented_java_files "${CMAKE_CURRENT_BINARY_DIR}/${java_file_name}-jdoc.java")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_command(
|
||||
@ -157,6 +179,8 @@ SET(JAVA_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src/org/opencv")
|
||||
foreach(java_file ${documented_java_files})
|
||||
get_filename_component(java_file_name "${java_file}" NAME)
|
||||
string(REPLACE "-jdoc.java" ".java" java_file_name "${java_file_name}")
|
||||
string(REPLACE "+" "/" java_file_name "${java_file_name}")
|
||||
|
||||
add_custom_command(
|
||||
TARGET ${api_target}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${java_file}" "${JAVA_OUTPUT_DIR}/${java_file_name}"
|
||||
|
@ -309,6 +309,7 @@ class JavaWrapperGenerator(object):
|
||||
//
|
||||
package org.opencv.%s;
|
||||
%s
|
||||
import org.opencv.utils;
|
||||
%s
|
||||
public class %s {
|
||||
|
||||
|
@ -12,42 +12,42 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nType
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nType
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->type( );
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nRows
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nRows
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->rows;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nCols
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nCols
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->cols;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nData
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nData
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return (jlong) me->data;
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsEmpty
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsEmpty
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->empty();
|
||||
}
|
||||
|
||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
|
||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
try {
|
||||
@ -65,7 +65,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
|
||||
#ifdef DEBUG
|
||||
LOGD("core::Mat::nSize() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -79,28 +79,28 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsCont
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsCont
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->isContinuous();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsSubmat
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsSubmat
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return me->isSubmatrix();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nSubmat
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nSubmat
|
||||
(JNIEnv* env, jclass cls, jlong self, jint r1, jint r2, jint c1, jint c2)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return (jlong) new cv::Mat(*me, cv::Range(r1, r2>0 ? r2 : me->rows), cv::Range(c1, c2>0 ? c2 : me->cols));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nClone
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nClone
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
@ -112,7 +112,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nClone
|
||||
// unlike other nPut()-s this one (with double[]) should convert input values to correct type
|
||||
#define PUT_ITEM(T, R, C) { T*dst = (T*)me->ptr(R, C); for(int ch=0; ch<me->channels() && count>0; count--,ch++,src++,dst++) *dst = cv::saturate_cast<T>(*src); }
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutD
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -196,7 +196,7 @@ template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count,
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -210,7 +210,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutS
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -224,7 +224,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutS
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutI
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -238,7 +238,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutI
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutF
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -293,7 +293,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -307,7 +307,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetS
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -321,7 +321,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetS
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetI
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -335,7 +335,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetI
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetF
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -349,7 +349,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetF
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetD
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -363,7 +363,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetD
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nGet
|
||||
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
|
||||
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self;
|
||||
@ -388,14 +388,14 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nGet
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_Mat_nSetTo
|
||||
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nSetTo
|
||||
(JNIEnv* env, jclass cls, jlong self, jdouble v0, jdouble v1, jdouble v2, jdouble v3)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
me->setTo( cv::Scalar(v0, v1, v2, v3) );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_Mat_nCopyTo
|
||||
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nCopyTo
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong m)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
@ -403,7 +403,7 @@ JNIEXPORT void JNICALL Java_org_opencv_Mat_nCopyTo
|
||||
me->copyTo( *_m );
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL Java_org_opencv_Mat_nDot
|
||||
JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_nDot
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong m)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
@ -411,7 +411,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_Mat_nDot
|
||||
return me->dot( *_m );
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCross
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong m)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
@ -419,26 +419,26 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross
|
||||
return (jlong) new cv::Mat(me->cross( *_m ));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nInv
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
return (jlong) new cv::Mat(me->inv());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__
|
||||
(JNIEnv* env, jclass cls)
|
||||
{
|
||||
return (jlong) new cv::Mat();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nEye
|
||||
(JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)
|
||||
{
|
||||
return (jlong) new cv::Mat(cv::Mat::eye( _rows, _cols, _type ));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_Mat_nDump
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
||||
(JNIEnv *env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
@ -447,27 +447,27 @@ JNIEXPORT jstring JNICALL Java_org_opencv_Mat_nDump
|
||||
return env->NewStringUTF(s.str().c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__III
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__III
|
||||
(JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)
|
||||
{
|
||||
//LOGD("called with r=%d, c=%d", _rows, _cols);
|
||||
return (jlong) new cv::Mat( _rows, _cols, _type );;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__IIIDDDD
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__IIIDDDD
|
||||
(JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type, jdouble v0, jdouble v1, jdouble v2, jdouble v3)
|
||||
{
|
||||
return (jlong) new cv::Mat( _rows, _cols, _type, cv::Scalar(v0, v1, v2, v3) );
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_Mat_nDelete
|
||||
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nDelete
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
delete me;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_Mat_nRelease
|
||||
JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nRelease
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||
|
@ -22,7 +22,7 @@ extern "C" {
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__
|
||||
(JNIEnv* env, jclass cls)
|
||||
{
|
||||
try {
|
||||
@ -37,7 +37,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1VideoCapture__() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -57,7 +57,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__I
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_highgui_VideoCapture_n_1VideoCapture__I
|
||||
(JNIEnv* env, jclass cls, jint device)
|
||||
{
|
||||
try {
|
||||
@ -72,7 +72,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__I
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1VideoCapture__I() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -93,7 +93,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_VideoCapture_n_1VideoCapture__I
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jdouble JNICALL Java_org_opencv_VideoCapture_n_1get
|
||||
JNIEXPORT jdouble JNICALL Java_org_opencv_highgui_VideoCapture_n_1get
|
||||
(JNIEnv* env, jclass cls, jlong self, jint propId)
|
||||
{
|
||||
try {
|
||||
@ -108,7 +108,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_VideoCapture_n_1get
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1get() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -129,7 +129,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_VideoCapture_n_1get
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1grab
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1grab
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
try {
|
||||
@ -144,7 +144,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1grab
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1grab() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -165,7 +165,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1grab
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1isOpened
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1isOpened
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
try {
|
||||
@ -180,7 +180,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1isOpened
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1isOpened() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -200,7 +200,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1isOpened
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1open__JI
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1open__JI
|
||||
(JNIEnv* env, jclass cls, jlong self, jint device)
|
||||
{
|
||||
try {
|
||||
@ -215,7 +215,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1open__JI
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1open__JI() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -236,7 +236,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1open__JI
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1read
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1read
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj)
|
||||
{
|
||||
try {
|
||||
@ -252,7 +252,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1read
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1read() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -273,7 +273,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1read
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_VideoCapture_n_1release
|
||||
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1release
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
try {
|
||||
@ -288,7 +288,7 @@ JNIEXPORT void JNICALL Java_org_opencv_VideoCapture_n_1release
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1release() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return;
|
||||
@ -309,7 +309,7 @@ JNIEXPORT void JNICALL Java_org_opencv_VideoCapture_n_1release
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJI
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJI
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj, jint channel)
|
||||
{
|
||||
try {
|
||||
@ -325,7 +325,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJI
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1retrieve__JJI() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -342,7 +342,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJI
|
||||
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJ
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1retrieve__JJ
|
||||
(JNIEnv* env, jclass cls, jlong self, jlong image_nativeObj)
|
||||
{
|
||||
try {
|
||||
@ -358,7 +358,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJ
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1retrieve__JJ() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -379,7 +379,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1retrieve__JJ
|
||||
//
|
||||
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1set
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_highgui_VideoCapture_n_1set
|
||||
(JNIEnv* env, jclass cls, jlong self, jint propId, jdouble value)
|
||||
{
|
||||
try {
|
||||
@ -394,7 +394,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1set
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1set() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return 0;
|
||||
@ -408,7 +408,7 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_VideoCapture_n_1set
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_VideoCapture_n_1getSupportedPreviewSizes
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_highgui_VideoCapture_n_1getSupportedPreviewSizes
|
||||
(JNIEnv *env, jclass cls, jlong self)
|
||||
{
|
||||
try {
|
||||
@ -423,7 +423,7 @@ JNIEXPORT jstring JNICALL Java_org_opencv_VideoCapture_n_1getSupportedPreviewSiz
|
||||
#ifdef DEBUG
|
||||
LOGD("highgui::VideoCapture_n_1getSupportedPreviewSizes() catched cv::Exception: %s", e.what());
|
||||
#endif // DEBUG
|
||||
jclass je = env->FindClass("org/opencv/CvException");
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
env->ThrowNew(je, e.what());
|
||||
return env->NewStringUTF("");
|
||||
@ -444,7 +444,7 @@ JNIEXPORT jstring JNICALL Java_org_opencv_VideoCapture_n_1getSupportedPreviewSiz
|
||||
// static void VideoCapture::n_delete( __int64 self )
|
||||
//
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_VideoCapture_n_1delete
|
||||
JNIEXPORT void JNICALL Java_org_opencv_highgui_VideoCapture_n_1delete
|
||||
(JNIEnv* env, jclass cls, jlong self)
|
||||
{
|
||||
delete (VideoCapture*) self;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.opencv;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class android {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
public class CvException extends Exception {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
|
||||
public final class CvType {
|
@ -1,10 +1,10 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Mat
|
||||
public class Mat {
|
||||
|
||||
|
||||
protected Mat(long nativeMat) {
|
||||
public Mat(long nativeMat) {
|
||||
/*if(nativeMat == 0)
|
||||
throw new java.lang.UnsupportedOperationException("Native object address is NULL");*/
|
||||
this.nativeObj = nativeMat;
|
||||
@ -44,7 +44,6 @@ public class Mat {
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
nDelete(nativeObj);
|
||||
nativeObj = 0;
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
@ -327,7 +326,7 @@ public class Mat {
|
||||
|
||||
// native stuff
|
||||
static { System.loadLibrary("opencv_java"); }
|
||||
protected long nativeObj;
|
||||
public final long nativeObj;
|
||||
private static native long nCreateMat();
|
||||
private static native long nCreateMat(int rows, int cols, int type);
|
||||
private static native long nCreateMat(int rows, int cols, int type, double v0, double v1, double v2, double v3);
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Point_
|
||||
public class Point {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Point3_
|
||||
public class Point3 {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Range
|
||||
public class Range {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Rect_
|
||||
public class Rect {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:RotatedRect_
|
||||
public class RotatedRect {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Scalar_
|
||||
public class Scalar {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Size_
|
||||
public class Size {
|
@ -1,4 +1,4 @@
|
||||
package org.opencv;
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:TermCriteria
|
||||
public class TermCriteria {
|
@ -1,8 +1,11 @@
|
||||
package org.opencv;
|
||||
package org.opencv.highgui;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
|
||||
// C++: class VideoCapture
|
||||
//javadoc: VideoCapture
|
||||
public class VideoCapture {
|
@ -2,6 +2,11 @@ package org.opencv;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.features2d.KeyPoint;
|
||||
|
||||
public class utils {
|
||||
|
||||
@ -72,7 +77,7 @@ public class utils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void Mat_to_vector_KeyPoint(Mat kp_mat, List<features2d.KeyPoint> kps) {
|
||||
public static void Mat_to_vector_KeyPoint(Mat kp_mat, List<KeyPoint> kps) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,13 @@
|
||||
package org.opencv.samples.tutorial1;
|
||||
|
||||
import org.opencv.*;
|
||||
import org.opencv.android;
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@ -36,15 +43,15 @@ class Sample1View extends SampleViewBase {
|
||||
|
||||
switch (Sample1Java.viewMode) {
|
||||
case Sample1Java.VIEW_MODE_GRAY:
|
||||
imgproc.cvtColor(mGraySubmat, mRgba, imgproc.COLOR_GRAY2RGBA, 4);
|
||||
Imgproc.cvtColor(mGraySubmat, mRgba, Imgproc.COLOR_GRAY2RGBA, 4);
|
||||
break;
|
||||
case Sample1Java.VIEW_MODE_RGBA:
|
||||
imgproc.cvtColor(mYuv, mRgba, imgproc.COLOR_YUV420i2RGB, 4);
|
||||
core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3);
|
||||
Imgproc.cvtColor(mYuv, mRgba, Imgproc.COLOR_YUV420i2RGB, 4);
|
||||
Core.putText(mRgba, "OpenCV + Android", new Point(10, 100), 3/* CV_FONT_HERSHEY_COMPLEX */, 2, new Scalar(255, 0, 0, 255), 3);
|
||||
break;
|
||||
case Sample1Java.VIEW_MODE_CANNY:
|
||||
imgproc.Canny(mGraySubmat, mIntermediateMat, 80, 100);
|
||||
imgproc.cvtColor(mIntermediateMat, mRgba, imgproc.COLOR_GRAY2BGRA, 4);
|
||||
Imgproc.Canny(mGraySubmat, mIntermediateMat, 80, 100);
|
||||
Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2BGRA, 4);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user