Merged upstream master
This commit is contained in:
@@ -159,7 +159,7 @@ foreach(java_file ${step3_input_files})
|
||||
|
||||
if(ANDROID)
|
||||
get_filename_component(install_subdir "${java_file_name}" PATH)
|
||||
install(FILES "${output_name}" DESTINATION "${JAVA_INSTALL_ROOT}/src/org/opencv/${install_subdir}" COMPONENT main)
|
||||
install(FILES "${output_name}" DESTINATION "${JAVA_INSTALL_ROOT}/src/org/opencv/${install_subdir}" COMPONENT java)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -173,7 +173,7 @@ if(ANDROID)
|
||||
|
||||
if(NOT file MATCHES "jni/.+")
|
||||
get_filename_component(install_subdir "${file}" PATH)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${file}" DESTINATION "${JAVA_INSTALL_ROOT}/${install_subdir}" COMPONENT main)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${file}" DESTINATION "${JAVA_INSTALL_ROOT}/${install_subdir}" COMPONENT java)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -209,11 +209,11 @@ if(ANDROID AND ANDROID_EXECUTABLE)
|
||||
list(APPEND copied_files ${lib_target_files} "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}")
|
||||
list(APPEND step3_input_files "${CMAKE_CURRENT_BINARY_DIR}/${ANDROID_MANIFEST_FILE}")
|
||||
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_PROJECT_PROPERTIES_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_PROJECT_PROPERTIES_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT java)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT java)
|
||||
# creating empty 'gen' and 'res' folders
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${JAVA_INSTALL_ROOT}/gen\")" COMPONENT main)
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${JAVA_INSTALL_ROOT}/res\")" COMPONENT main)
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${JAVA_INSTALL_ROOT}/gen\")" COMPONENT java)
|
||||
install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${JAVA_INSTALL_ROOT}/res\")" COMPONENT java)
|
||||
endif(ANDROID AND ANDROID_EXECUTABLE)
|
||||
|
||||
set(step3_depends ${step2_depends} ${step3_input_files} ${copied_files})
|
||||
@@ -250,7 +250,7 @@ if(ANDROID)
|
||||
else(ANDROID)
|
||||
set(JAR_NAME opencv-${LIB_NAME_SUFIX}.jar)
|
||||
set(JAR_FILE "${OpenCV_BINARY_DIR}/bin/${JAR_NAME}")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OpenCV_BINARY_DIR}/build.xml" IMMEDIATE @ONLY)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OpenCV_BINARY_DIR}/build.xml" @ONLY)
|
||||
list(APPEND step3_depends "${OpenCV_BINARY_DIR}/build.xml")
|
||||
|
||||
add_custom_command(OUTPUT "${JAR_FILE}" "${JAR_FILE}.dephelper"
|
||||
@@ -266,7 +266,7 @@ else(ANDROID)
|
||||
else(WIN32)
|
||||
set(JAR_INSTALL_DIR share/OpenCV/java)
|
||||
endif(WIN32)
|
||||
install(FILES ${JAR_FILE} DESTINATION ${JAR_INSTALL_DIR} COMPONENT main)
|
||||
install(FILES ${JAR_FILE} DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
|
||||
endif(ANDROID)
|
||||
|
||||
# step 5: build native part
|
||||
@@ -337,17 +337,17 @@ endif()
|
||||
|
||||
if(ANDROID)
|
||||
ocv_install_target(${the_module} EXPORT OpenCVModules
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
|
||||
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT java
|
||||
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT java)
|
||||
else()
|
||||
if(NOT INSTALL_CREATE_DISTRIB)
|
||||
ocv_install_target(${the_module} EXPORT OpenCVModules
|
||||
RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT main
|
||||
LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT main)
|
||||
RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT java
|
||||
LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
|
||||
else()
|
||||
ocv_install_target(${the_module} EXPORT OpenCVModules
|
||||
RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT main
|
||||
LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT main)
|
||||
RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java
|
||||
LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ class_ignore_list = (
|
||||
const_ignore_list = (
|
||||
"CV_CAP_OPENNI",
|
||||
"CV_CAP_PROP_OPENNI_",
|
||||
"CV_CAP_INTELPERC",
|
||||
"CV_CAP_PROP_INTELPERC_"
|
||||
"WINDOW_AUTOSIZE",
|
||||
"CV_WND_PROP_",
|
||||
"CV_WINDOW_",
|
||||
@@ -396,7 +398,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual
|
||||
|
||||
return result;
|
||||
|
||||
} catch(cv::Exception e) {
|
||||
} catch(const cv::Exception& e) {
|
||||
LOGD("Core::n_1minMaxLoc() catched cv::Exception: %s", e.what());
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
@@ -469,7 +471,7 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1getTextSize
|
||||
|
||||
return result;
|
||||
|
||||
} catch(cv::Exception e) {
|
||||
} catch(const cv::Exception& e) {
|
||||
LOGD("Core::n_1getTextSize() catched cv::Exception: %s", e.what());
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
if(!je) je = env->FindClass("java/lang/Exception");
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import os, sys, re, string, fnmatch
|
||||
|
||||
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "cuda", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "ocl", "softcascade", "superres"]
|
||||
allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "cuda", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab", "softcascade", "superres"]
|
||||
verbose = False
|
||||
show_warnings = True
|
||||
show_errors = True
|
||||
|
||||
@@ -467,7 +467,7 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims
|
||||
LOGD("%s", method_name);
|
||||
Mat* me = (Mat*) self; //TODO: check for NULL
|
||||
return me->dims;
|
||||
} catch(cv::Exception e) {
|
||||
} catch(const cv::Exception& e) {
|
||||
throwJavaException(env, &e, method_name);
|
||||
} catch (...) {
|
||||
throwJavaException(env, 0, method_name);
|
||||
|
||||
@@ -48,7 +48,7 @@ JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nBitmapToMat2
|
||||
}
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
return;
|
||||
} catch(cv::Exception e) {
|
||||
} catch(const cv::Exception& e) {
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
LOGE("nBitmapToMat catched cv::Exception: %s", e.what());
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
@@ -130,7 +130,7 @@ JNIEXPORT void JNICALL Java_org_opencv_android_Utils_nMatToBitmap2
|
||||
}
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
return;
|
||||
} catch(cv::Exception e) {
|
||||
} catch(const cv::Exception& e) {
|
||||
AndroidBitmap_unlockPixels(env, bitmap);
|
||||
LOGE("nMatToBitmap catched cv::Exception: %s", e.what());
|
||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||
|
||||
@@ -22,6 +22,7 @@ public class NativeCameraView extends CameraBridgeViewBase {
|
||||
private Thread mThread;
|
||||
|
||||
protected VideoCapture mCamera;
|
||||
protected NativeCameraFrame mFrame;
|
||||
|
||||
public NativeCameraView(Context context, int cameraId) {
|
||||
super(context, cameraId);
|
||||
@@ -97,6 +98,8 @@ public class NativeCameraView extends CameraBridgeViewBase {
|
||||
if (mCamera.isOpened() == false)
|
||||
return false;
|
||||
|
||||
mFrame = new NativeCameraFrame(mCamera);
|
||||
|
||||
java.util.List<Size> sizes = mCamera.getSupportedPreviewSizes();
|
||||
|
||||
/* Select the size that fits surface considering maximum size allowed */
|
||||
@@ -127,9 +130,8 @@ public class NativeCameraView extends CameraBridgeViewBase {
|
||||
|
||||
private void releaseCamera() {
|
||||
synchronized (this) {
|
||||
if (mCamera != null) {
|
||||
mCamera.release();
|
||||
}
|
||||
if (mFrame != null) mFrame.release();
|
||||
if (mCamera != null) mCamera.release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +155,11 @@ public class NativeCameraView extends CameraBridgeViewBase {
|
||||
mRgba = new Mat();
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (mGray != null) mGray.release();
|
||||
if (mRgba != null) mRgba.release();
|
||||
}
|
||||
|
||||
private VideoCapture mCapture;
|
||||
private Mat mRgba;
|
||||
private Mat mGray;
|
||||
@@ -167,7 +174,7 @@ public class NativeCameraView extends CameraBridgeViewBase {
|
||||
break;
|
||||
}
|
||||
|
||||
deliverAndDrawFrame(new NativeCameraFrame(mCamera));
|
||||
deliverAndDrawFrame(mFrame);
|
||||
|
||||
} while (!mStopThread);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ public class OpenCVLoader
|
||||
*/
|
||||
public static final String OPENCV_VERSION_2_4_7 = "2.4.7";
|
||||
|
||||
/**
|
||||
* OpenCV Library version 2.4.8.
|
||||
*/
|
||||
public static final String OPENCV_VERSION_2_4_8 = "2.4.8";
|
||||
|
||||
/**
|
||||
* Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
|
||||
@@ -44,7 +48,17 @@ public class OpenCVLoader
|
||||
*/
|
||||
public static boolean initDebug()
|
||||
{
|
||||
return StaticHelper.initOpenCV();
|
||||
return StaticHelper.initOpenCV(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
|
||||
* @param InitCuda load and initialize CUDA runtime libraries.
|
||||
* @return Returns true is initialization of OpenCV was successful.
|
||||
*/
|
||||
public static boolean initDebug(boolean InitCuda)
|
||||
{
|
||||
return StaticHelper.initOpenCV(InitCuda);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,21 @@ import android.util.Log;
|
||||
|
||||
class StaticHelper {
|
||||
|
||||
public static boolean initOpenCV()
|
||||
public static boolean initOpenCV(boolean InitCuda)
|
||||
{
|
||||
boolean result;
|
||||
String libs = "";
|
||||
|
||||
if(InitCuda)
|
||||
{
|
||||
loadLibrary("cudart");
|
||||
loadLibrary("nppc");
|
||||
loadLibrary("nppi");
|
||||
loadLibrary("npps");
|
||||
loadLibrary("cufft");
|
||||
loadLibrary("cublas");
|
||||
}
|
||||
|
||||
Log.d(TAG, "Trying to get library list");
|
||||
|
||||
try
|
||||
@@ -52,7 +62,7 @@ class StaticHelper {
|
||||
try
|
||||
{
|
||||
System.loadLibrary(Name);
|
||||
Log.d(TAG, "OpenCV libs init was ok!");
|
||||
Log.d(TAG, "Library " + Name + " loaded");
|
||||
}
|
||||
catch(UnsatisfiedLinkError e)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,6 @@ public class TermCriteria {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this == null) return "null";
|
||||
return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user