Added Java packages support to cmake
authorAndrey Kamaev <no@email>
Tue, 19 Jul 2011 15:37:17 +0000 (15:37 +0000)
committerAndrey Kamaev <no@email>
Tue, 19 Jul 2011 15:37:17 +0000 (15:37 +0000)
19 files changed:
modules/java/CMakeLists.txt
modules/java/gen_java.py
modules/java/src/cpp/Mat.cpp
modules/java/src/cpp/VideoCapture.cpp
modules/java/src/java/android.java
modules/java/src/java/core+CvException.java [moved from modules/java/src/java/CvException.java with 85% similarity]
modules/java/src/java/core+CvType.java [moved from modules/java/src/java/CvType.java with 95% similarity]
modules/java/src/java/core+Mat.java [moved from modules/java/src/java/Mat.java with 96% similarity]
modules/java/src/java/core+Point.java [moved from modules/java/src/java/Point.java with 93% similarity]
modules/java/src/java/core+Point3.java [moved from modules/java/src/java/Point3.java with 94% similarity]
modules/java/src/java/core+Range.java [moved from modules/java/src/java/Range.java with 94% similarity]
modules/java/src/java/core+Rect.java [moved from modules/java/src/java/Rect.java with 95% similarity]
modules/java/src/java/core+RotatedRect.java [moved from modules/java/src/java/RotatedRect.java with 96% similarity]
modules/java/src/java/core+Scalar.java [moved from modules/java/src/java/Scalar.java with 94% similarity]
modules/java/src/java/core+Size.java [moved from modules/java/src/java/Size.java with 93% similarity]
modules/java/src/java/core+TermCriteria.java [moved from modules/java/src/java/TermCriteria.java with 95% similarity]
modules/java/src/java/highgui+VideoCapture.java [moved from modules/java/src/java/VideoCapture.java with 98% similarity]
modules/java/src/java/utils.java
samples/android/tutorial-1-addopencv/src/org/opencv/samples/tutorial1/Sample1View.java

index faef5ff..aa730e7 100644 (file)
@@ -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}"
index 42ed018..f7c07bf 100644 (file)
@@ -309,6 +309,7 @@ class JavaWrapperGenerator(object):
 //\r
 package org.opencv.%s;\r
 %s\r
+import org.opencv.utils;\r
 %s\r
 public class %s {\r
 \r
index 65fb738..ae580f8 100644 (file)
 extern "C" {\r
 #endif\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nType\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nType\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->type(  );\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nRows\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nRows\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->rows;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nCols\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nCols\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->cols;\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nData\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nData\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return (jlong) me->data;\r
 }\r
 \r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsEmpty\r
+JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsEmpty\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->empty();\r
 }\r
 \r
-JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize\r
+JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nSize\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     try {\r
@@ -65,7 +65,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
 #ifdef DEBUG\r
         LOGD("core::Mat::nSize() catched cv::Exception: %s", e.what());\r
 #endif // DEBUG\r
-        jclass je = env->FindClass("org/opencv/CvException");\r
+        jclass je = env->FindClass("org/opencv/core/CvException");\r
         if(!je) je = env->FindClass("java/lang/Exception");\r
         env->ThrowNew(je, e.what());\r
         return 0;\r
@@ -79,28 +79,28 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nSize
     }\r
 }\r
 \r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsCont\r
+JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsCont\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->isContinuous();\r
 }\r
 \r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsSubmat\r
+JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_nIsSubmat\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return me->isSubmatrix();\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nSubmat\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nSubmat\r
        (JNIEnv* env, jclass cls, jlong self, jint r1, jint r2, jint c1, jint c2)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     return (jlong) new cv::Mat(*me, cv::Range(r1, r2>0 ? r2 : me->rows), cv::Range(c1, c2>0 ? c2 : me->cols));\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nClone\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nClone\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
@@ -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\r
 #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); }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutD\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -196,7 +196,7 @@ template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count,
 extern "C" {\r
 #endif\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -210,7 +210,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutS\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -224,7 +224,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutS
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutI\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -238,7 +238,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutI
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutF\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -293,7 +293,7 @@ extern "C" {
 #endif\r
 \r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -307,7 +307,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetS\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jshortArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -321,7 +321,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetS
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetI\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jintArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -335,7 +335,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetI
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetF\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jfloatArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -349,7 +349,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetF
        return res;\r
 }\r
 \r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetD\r
+JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jdoubleArray vals)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -363,7 +363,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetD
        return res;\r
 }\r
 \r
-JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nGet\r
+JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet\r
        (JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count)\r
 {\r
        cv::Mat* me = (cv::Mat*) self;\r
@@ -388,14 +388,14 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_Mat_nGet
        return res;\r
 }\r
 \r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nSetTo\r
+JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nSetTo\r
   (JNIEnv* env, jclass cls, jlong self, jdouble v0, jdouble v1, jdouble v2, jdouble v3)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     me->setTo( cv::Scalar(v0, v1, v2, v3) );\r
 }\r
 \r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nCopyTo\r
+JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nCopyTo\r
   (JNIEnv* env, jclass cls, jlong self, jlong m)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
@@ -403,7 +403,7 @@ JNIEXPORT void JNICALL Java_org_opencv_Mat_nCopyTo
     me->copyTo( *_m );\r
 }\r
 \r
-JNIEXPORT jdouble JNICALL Java_org_opencv_Mat_nDot\r
+JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_nDot\r
   (JNIEnv* env, jclass cls, jlong self, jlong m)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
@@ -411,7 +411,7 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_Mat_nDot
     return me->dot( *_m );\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCross\r
        (JNIEnv* env, jclass cls, jlong self, jlong m)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
@@ -419,26 +419,26 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross
     return (jlong) new cv::Mat(me->cross( *_m ));\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nInv\r
        (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL    \r
        return (jlong) new cv::Mat(me->inv());\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__\r
   (JNIEnv* env, jclass cls)\r
 {\r
     return (jlong) new cv::Mat();\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nEye\r
     (JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)\r
 {\r
     return (jlong) new cv::Mat(cv::Mat::eye( _rows, _cols, _type ));\r
 }\r
 \r
-JNIEXPORT jstring JNICALL Java_org_opencv_Mat_nDump\r
+JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump\r
   (JNIEnv *env, jclass cls, jlong self)\r
 {\r
        cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
@@ -447,27 +447,27 @@ JNIEXPORT jstring JNICALL Java_org_opencv_Mat_nDump
        return env->NewStringUTF(s.str().c_str());\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__III\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__III\r
   (JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)\r
 {\r
     //LOGD("called with r=%d, c=%d", _rows, _cols);\r
     return (jlong) new cv::Mat( _rows, _cols, _type );;\r
 }\r
 \r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__IIIDDDD\r
+JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_nCreateMat__IIIDDDD\r
   (JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type, jdouble v0, jdouble v1, jdouble v2, jdouble v3)\r
 {\r
     return (jlong) new cv::Mat( _rows, _cols, _type, cv::Scalar(v0, v1, v2, v3) );\r
 }\r
 \r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nDelete\r
+JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nDelete\r
   (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
     delete me;\r
 }\r
 \r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nRelease\r
+JNIEXPORT void JNICALL Java_org_opencv_core_Mat_nRelease\r
   (JNIEnv* env, jclass cls, jlong self)\r
 {\r
     cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
index 1271204..b796f72 100644 (file)
@@ -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;
index 4d5c560..a1a6a64 100644 (file)
@@ -1,5 +1,6 @@
 package org.opencv;\r
 \r
+import org.opencv.core.Mat;\r
 import android.graphics.Bitmap;\r
 \r
 public class android {\r
similarity index 85%
rename from modules/java/src/java/CvException.java
rename to modules/java/src/java/core+CvException.java
index 824c855..1ad0e3a 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 public class CvException extends Exception {\r
 \r
similarity index 95%
rename from modules/java/src/java/CvType.java
rename to modules/java/src/java/core+CvType.java
index fa94806..cef9de4 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 \r
 public final class CvType {\r
similarity index 96%
rename from modules/java/src/java/Mat.java
rename to modules/java/src/java/core+Mat.java
index 31b01dd..d7a57d7 100644 (file)
@@ -1,10 +1,10 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Mat\r
 public class Mat {\r
 \r
 \r
-    protected Mat(long nativeMat) {\r
+    public Mat(long nativeMat) {\r
         /*if(nativeMat == 0) \r
             throw new java.lang.UnsupportedOperationException("Native object address is NULL");*/\r
         this.nativeObj = nativeMat;\r
@@ -44,7 +44,6 @@ public class Mat {
     @Override\r
     protected void finalize() throws Throwable {\r
         nDelete(nativeObj);\r
-        nativeObj = 0;\r
         super.finalize();\r
     }\r
 \r
@@ -327,7 +326,7 @@ public class Mat {
     \r
     // native stuff\r
     static { System.loadLibrary("opencv_java"); }\r
-    protected long nativeObj;\r
+    public final long nativeObj;\r
     private static native long nCreateMat();\r
     private static native long nCreateMat(int rows, int cols, int type);\r
     private static native long nCreateMat(int rows, int cols, int type, double v0, double v1, double v2, double v3);\r
similarity index 93%
rename from modules/java/src/java/Point.java
rename to modules/java/src/java/core+Point.java
index 3fb0923..667b9f8 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Point_\r
 public class Point {\r
similarity index 94%
rename from modules/java/src/java/Point3.java
rename to modules/java/src/java/core+Point3.java
index f77d7f6..33cd441 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Point3_\r
 public class Point3 {\r
similarity index 94%
rename from modules/java/src/java/Range.java
rename to modules/java/src/java/core+Range.java
index 03b6dc7..826b6e8 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Range\r
 public class Range {\r
similarity index 95%
rename from modules/java/src/java/Rect.java
rename to modules/java/src/java/core+Rect.java
index e6caf36..53499d0 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Rect_\r
 public class Rect {\r
similarity index 96%
rename from modules/java/src/java/RotatedRect.java
rename to modules/java/src/java/core+RotatedRect.java
index c86042f..d8eaaaa 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:RotatedRect_\r
 public class RotatedRect {\r
similarity index 94%
rename from modules/java/src/java/Scalar.java
rename to modules/java/src/java/core+Scalar.java
index e9222f0..6c45c15 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Scalar_\r
 public class Scalar {\r
similarity index 93%
rename from modules/java/src/java/Size.java
rename to modules/java/src/java/core+Size.java
index 3839594..23ce4cd 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:Size_\r
 public class Size {\r
similarity index 95%
rename from modules/java/src/java/TermCriteria.java
rename to modules/java/src/java/core+TermCriteria.java
index e7e3766..7458b61 100644 (file)
@@ -1,4 +1,4 @@
-package org.opencv;\r
+package org.opencv.core;\r
 \r
 //javadoc:TermCriteria\r
 public class TermCriteria {\r
similarity index 98%
rename from modules/java/src/java/VideoCapture.java
rename to modules/java/src/java/highgui+VideoCapture.java
index 51f9764..c6cf5b0 100644 (file)
@@ -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 {
index 58748d4..d93be22 100644 (file)
@@ -2,6 +2,11 @@ package org.opencv;
 \r
 import java.util.List;\r
 \r
+import org.opencv.core.Mat;\r
+import org.opencv.core.CvType;\r
+import org.opencv.core.Point;\r
+import org.opencv.core.Rect;\r
+import org.opencv.features2d.KeyPoint;\r
 \r
 public class utils {\r
        \r
@@ -72,7 +77,7 @@ public class utils {
                }\r
        }\r
 \r
-       public static void Mat_to_vector_KeyPoint(Mat kp_mat, List<features2d.KeyPoint> kps) {\r
+       public static void Mat_to_vector_KeyPoint(Mat kp_mat, List<KeyPoint> kps) {\r
                // TODO Auto-generated method stub\r
        }\r
 \r
index 62f3bfd..59f4062 100644 (file)
@@ -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;
         }