diff --git a/CMakeLists.txt b/CMakeLists.txt
index 94bad953df..aa79689372 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -151,13 +151,8 @@ OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests"
OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON )
OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC )
OCV_OPTION(BUILD_FAT_JAVA_LIB "Create fat java wrapper containing the whole OpenCV library" ON IF ANDROID AND NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX )
-OCV_OPTION(BUILD_ANDROID_SERVICE "TBD" OFF IF ANDROID AND ANDROID_USE_STLPORT AND ANDROID_SOURCE_TREE )
-
-if(DEFINED BUILD_opencv_nonfree AND NOT BUILD_opencv_nonfree)
- OCV_OPTION(BUILD_ANDROID_PACKAGE "TBD" OFF IF ANDROID )
-else()
- unset(BUILD_ANDROID_PACKAGE CACHE)
-endif()
+OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID AND ANDROID_USE_STLPORT AND ANDROID_SOURCE_TREE )
+OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
# 3rd party libs
@@ -231,15 +226,15 @@ else()
endif()
if(ANDROID)
- set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
- set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
+ set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
+ set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
set(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME})
set(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
set(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni)
set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
else()
- set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
- set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
+ set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
+ set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX})
set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
set(OPENCV_INCLUDE_INSTALL_PATH include)
diff --git a/android/package/AndroidManifest.xml b/android/package/AndroidManifest.xml
new file mode 100644
index 0000000000..3b6bc7d047
--- /dev/null
+++ b/android/package/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/package/CMakeLists.txt b/android/package/CMakeLists.txt
index 16b8469edd..35025b3e8f 100644
--- a/android/package/CMakeLists.txt
+++ b/android/package/CMakeLists.txt
@@ -1,2 +1,93 @@
-#tbd
-add_subdirectory(info_lib)
+if(NOT ANDROID_PACKAGE_RELEASE)
+ set(ANDROID_PACKAGE_RELEASE 1)
+endif()
+
+if(NOT ANDROID_PACKAGE_PLATFORM)
+ if(ARMEABI_V7A)
+ if(NEON)
+ set(ANDROID_PACKAGE_PLATFORM armv7a_neon)
+ else()
+ set(ANDROID_PACKAGE_PLATFORM armv7a)
+ endif()
+ elseif(ARMEABI_V6)
+ set(ANDROID_PACKAGE_PLATFORM armv6)
+ elseif(ARMEABI)
+ set(ANDROID_PACKAGE_PLATFORM armv5)
+ elseif(X86)
+ set(ANDROID_PACKAGE_PLATFORM x86)
+ elseif(MIPS)
+ set(ANDROID_PACKAGE_PLATFORM mips)
+ else()
+ message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM")
+ endif()
+endif()
+
+if(NOT ANDROID_PACKAGE_PLATFORM_NAME)
+ if(ARMEABI_V7A)
+ if(NEON)
+ set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a with NEON")
+ else()
+ set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v7a")
+ endif()
+ elseif(ARMEABI_V6)
+ set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi-v6")
+ elseif(ARMEABI)
+ set(ANDROID_PACKAGE_PLATFORM_NAME "armeabi")
+ elseif(X86)
+ set(ANDROID_PACKAGE_PLATFORM_NAME "x86")
+ elseif(MIPS)
+ set(ANDROID_PACKAGE_PLATFORM_NAME "mips")
+ else()
+ message(ERROR "Can not automatically determine the value for ANDROID_PACKAGE_PLATFORM_NAME")
+ endif()
+endif()
+
+if("${ANDROID_NATIVE_API_LEVEL}" MATCHES "[1-9][0-9]*$")
+ set(ANDROID_SDK_VERSION ${CMAKE_MATCH_0})
+endif()
+
+if(NOT ANDROID_SDK_VERSION GREATER 7)
+ set(ANDROID_SDK_VERSION 8)
+endif()
+
+set(PACKAGE_DIR "${OpenCV_BINARY_DIR}/package")
+
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/values/strings.xml" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/drawable/icon.png" "${PACKAGE_DIR}/res/drawable/icon.png" COPYONLY)
+
+set(target_name "OpenCV_${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}_binary_pack_${ANDROID_PACKAGE_PLATFORM}")
+get_target_property(opencv_java_location opencv_java LOCATION)
+
+set(android_proj_target_files ${ANDROID_PROJECT_FILES})
+ocv_list_add_prefix(android_proj_target_files "${PACKAGE_DIR}/")
+android_get_compatible_target(android_proj_sdk_target ${ANDROID_SDK_VERSION})
+set(APK_NAME "${PACKAGE_DIR}/bin/${target_name}-release-unsigned.apk")
+
+file(GLOB camera_wrappers "${OpenCV_SOURCE_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so")
+set(CAMERA_LIB_COMMANDS "")
+
+foreach(wrapper ${camera_wrappers})
+ list(APPEND CAMERA_LIB_COMMANDS COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/")
+endforeach()
+
+add_custom_command(
+ OUTPUT "${APK_NAME}"
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/libs"
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/bin"
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${PACKAGE_DIR}/gen"
+ COMMAND ${CMAKE_COMMAND} -E remove ${android_proj_target_files}
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/src"
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
+ ${CAMERA_LIB_COMMANDS}
+ COMMAND ${CMAKE_COMMAND} -E copy "${opencv_java_location}" "${PACKAGE_DIR}/libs/${ANDROID_NDK_ABI_NAME}/"
+ COMMAND ${ANDROID_EXECUTABLE} --silent update project --path "${PACKAGE_DIR}" --target "${android_proj_sdk_target}" --name "${target_name}"
+ COMMAND ${ANT_EXECUTABLE} -q -noinput -k release
+ COMMAND ${CMAKE_COMMAND} -E touch "${APK_NAME}"
+ WORKING_DIRECTORY "${PACKAGE_DIR}"
+ MAIN_DEPENDENCY "${opencv_java_location}"
+ DEPENDS "${PACKAGE_DIR}/${ANDROID_MANIFEST_FILE}" "${PACKAGE_DIR}/res/values/strings.xml" "${PACKAGE_DIR}/res/drawable/icon.png" ${camera_wrappers}
+ )
+
+add_custom_target(android_package ALL SOURCES "${APK_NAME}" )
+add_dependencies(android_package opencv_java)
\ No newline at end of file
diff --git a/android/package/info_lib/CMakeLists.txt b/android/package/info_lib/CMakeLists.txt
deleted file mode 100644
index 7e9e9fe112..0000000000
--- a/android/package/info_lib/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-#tbd
diff --git a/android/package/info_lib/jni/Android.mk b/android/package/info_lib/jni/Android.mk
deleted file mode 100644
index 89cc462793..0000000000
--- a/android/package/info_lib/jni/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
- src/info.c
-
-LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- $(TOP)/frameworks/base/core/jni
-
-LOCAL_PRELINK_MODULE := false
-
-LOCAL_MODULE := libopencvinfo
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/android/package/info_lib/jni/Application.mk b/android/package/info_lib/jni/Application.mk
deleted file mode 100644
index c1d3a3fe66..0000000000
--- a/android/package/info_lib/jni/Application.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-APP_ABI := armeabi-v7a x86
-APP_PLATFORM := android-8
\ No newline at end of file
diff --git a/android/package/info_lib/jni/include/info.h b/android/package/info_lib/jni/include/info.h
deleted file mode 100644
index b9ba35fbaf..0000000000
--- a/android/package/info_lib/jni/include/info.h
+++ /dev/null
@@ -1,3 +0,0 @@
-// Function return list of shared libs seporated with ";" symbol
-// in load order
-const char* GetLibraryList();
\ No newline at end of file
diff --git a/android/package/info_lib/jni/include/info_jni.h b/android/package/info_lib/jni/include/info_jni.h
deleted file mode 100644
index 28df21758a..0000000000
--- a/android/package/info_lib/jni/include/info_jni.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include
-/* Header for class org_opencv_android_OpenCVLoader */
-
-#ifndef _Included_org_opencv_android_OpenCVLoader
-#define _Included_org_opencv_android_OpenCVLoader
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef org_opencv_android_OpenCVLoader_Success
-#define org_opencv_android_OpenCVLoader_Success 0L
-#undef org_opencv_android_OpenCVLoader_NoService
-#define org_opencv_android_OpenCVLoader_NoService 1L
-#undef org_opencv_android_OpenCVLoader_RestartRequired
-#define org_opencv_android_OpenCVLoader_RestartRequired 2L
-#undef org_opencv_android_OpenCVLoader_MarketError
-#define org_opencv_android_OpenCVLoader_MarketError 3L
-#undef org_opencv_android_OpenCVLoader_InitFailed
-#define org_opencv_android_OpenCVLoader_InitFailed 255L
-/*
- * Class: org_opencv_android_OpenCVLoader
- * Method: GetLibraryList
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList
- (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/android/package/info_lib/jni/src/info.c b/android/package/info_lib/jni/src/info.c
deleted file mode 100644
index 6d445de8f1..0000000000
--- a/android/package/info_lib/jni/src/info.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "info.h"
-#include
-
-#ifndef LIB_STRING
- #define LIB_STRING "libtbb.so;libopencv_java.so"
-#endif
-
-const char* GetLibraryList()
-{
- return LIB_STRING;
-}
-
-JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv* jenv, jclass clazz)
-{
- jstring result = (*jenv)->NewStringUTF(jenv, LIB_STRING);
-
- return result;
-}
\ No newline at end of file
diff --git a/android/package/res/drawable/icon.png b/android/package/res/drawable/icon.png
new file mode 100644
index 0000000000..4e828bafd8
Binary files /dev/null and b/android/package/res/drawable/icon.png differ
diff --git a/android/package/res/values/strings.xml b/android/package/res/values/strings.xml
new file mode 100644
index 0000000000..c8f59be469
--- /dev/null
+++ b/android/package/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+
+
+ OCV @OPENCV_VERSION_MAJOR@.@OPENCV_VERSION_MINOR@ binary pack for @ANDROID_PACKAGE_PLATFORM_NAME@
+
+
\ No newline at end of file
diff --git a/android/service/engine/jni/NativeService/PackageInfo.h b/android/service/engine/jni/NativeService/PackageInfo.h
index ac82d37eb2..d9d93b5213 100644
--- a/android/service/engine/jni/NativeService/PackageInfo.h
+++ b/android/service/engine/jni/NativeService/PackageInfo.h
@@ -8,7 +8,7 @@
#define ARCH_X64_NAME "x64"
#define ARCH_ARMv5_NAME "armv5"
#define ARCH_ARMv6_NAME "armv6"
-#define ARCH_ARMv7_NAME "armv7"
+#define ARCH_ARMv7_NAME "armv7a"
#define ARCH_ARMv8_NAME "armv8"
#define FEATURES_HAS_VFPv3d16_NAME "vfpv3d16"
@@ -26,7 +26,7 @@
class PackageInfo
-{
+{
public:
PackageInfo(const std::string& version, int platform, int cpu_id);
PackageInfo(const std::string& fullname, const std::string& install_path, const std::string& package_version = "0.0");
@@ -38,7 +38,7 @@ public:
bool operator==(const PackageInfo& package) const;
static const std::map PlatformNameMap;
bool IsValid() const;
-
+
protected:
static std::map InitPlatformNameMap();
std::string Version;
diff --git a/cmake/OpenCVDetectAndroidSDK.cmake b/cmake/OpenCVDetectAndroidSDK.cmake
index 95b5d69101..f1bc5499f7 100644
--- a/cmake/OpenCVDetectAndroidSDK.cmake
+++ b/cmake/OpenCVDetectAndroidSDK.cmake
@@ -175,6 +175,7 @@ macro(android_get_compatible_target VAR)
endif()
endmacro()
+unset(__android_project_chain CACHE)
#add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11)
macro(add_android_project target path)
# parse arguments
@@ -288,17 +289,18 @@ macro(add_android_project target path)
COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
WORKING_DIRECTORY "${android_proj_bin_dir}"
MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
- DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
+ DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME} ${__android_project_chain})
else()
- add_custom_command(
- OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
- COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
- COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
- WORKING_DIRECTORY "${android_proj_bin_dir}"
- MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
- DEPENDS "${OpenCV_BINARY_DIR}/bin/classes.jar" opencv_java # as we are part of OpenCV we can just force this dependency
- DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME})
+ add_custom_command(
+ OUTPUT "${android_proj_bin_dir}/bin/${target}-debug.apk"
+ COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
+ COMMAND ${CMAKE_COMMAND} -E touch "${android_proj_bin_dir}/bin/${target}-debug.apk" # needed because ant does not update the timestamp of updated apk
+ WORKING_DIRECTORY "${android_proj_bin_dir}"
+ MAIN_DEPENDENCY "${android_proj_bin_dir}/${ANDROID_MANIFEST_FILE}"
+ DEPENDS "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper" opencv_java # as we are part of OpenCV we can just force this dependency
+ DEPENDS ${android_proj_file_deps} ${JNI_LIB_NAME} ${__android_project_chain})
endif()
+ set(__android_project_chain ${target} CACHE INTERNAL "auxiliary variable used for Android progects chaining")
unset(JNI_LIB_NAME)
diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp
index f4b60fcf3c..e5be8f70d4 100644
--- a/modules/core/include/opencv2/core/core.hpp
+++ b/modules/core/include/opencv2/core/core.hpp
@@ -4320,6 +4320,7 @@ public:
CV_WRAP_AS(setMat) void set(const string& name, const Mat& value);
CV_WRAP_AS(setMatVector) void set(const string& name, const vector& value);
CV_WRAP_AS(setAlgorithm) void set(const string& name, const Ptr& value);
+ template void set(const string& name, const Ptr<_Tp>& value);
void set(const char* name, int value);
void set(const char* name, double value);
@@ -4328,6 +4329,7 @@ public:
void set(const char* name, const Mat& value);
void set(const char* name, const vector& value);
void set(const char* name, const Ptr& value);
+ template void set(const char* name, const Ptr<_Tp>& value);
CV_WRAP string paramHelp(const string& name) const;
int paramType(const char* name) const;
diff --git a/modules/core/include/opencv2/core/mat.hpp b/modules/core/include/opencv2/core/mat.hpp
index 1c79f50c16..ccc02571e8 100644
--- a/modules/core/include/opencv2/core/mat.hpp
+++ b/modules/core/include/opencv2/core/mat.hpp
@@ -759,7 +759,8 @@ inline SVD::SVD() {}
inline SVD::SVD( InputArray m, int flags ) { operator ()(m, flags); }
inline void SVD::solveZ( InputArray m, OutputArray _dst )
{
- SVD svd(m);
+ Mat mtx = m.getMat();
+ SVD svd(mtx, (mtx.rows >= mtx.cols ? 0 : SVD::FULL_UV));
_dst.create(svd.vt.cols, 1, svd.vt.type());
Mat dst = _dst.getMat();
svd.vt.row(svd.vt.rows-1).reshape(1,svd.vt.cols).copyTo(dst);
diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp
index c7bc94ca1a..1f81848904 100644
--- a/modules/core/include/opencv2/core/operations.hpp
+++ b/modules/core/include/opencv2/core/operations.hpp
@@ -3842,6 +3842,22 @@ template inline Ptr<_Tp> Algorithm::create(const string& name)
return _create(name).ptr<_Tp>();
}
+template
+void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
+{
+ Ptr algo_ptr = value. template ptr();
+ if (algo_ptr.empty()) {
+ CV_Error( CV_StsUnsupportedFormat, "unknown/unsupported Ptr type of the second parameter of the method Algorithm::set");
+ }
+ info()->set(this, _name, ParamType::type, &algo_ptr);
+}
+template
+void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
+{
+ this->set<_Tp>(_name.c_str(), value);
+}
+
+
template inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const
{
typename ParamType<_Tp>::member_type value;
diff --git a/modules/core/test/test_operations.cpp b/modules/core/test/test_operations.cpp
index 5297f95f24..fd9c42b29d 100644
--- a/modules/core/test/test_operations.cpp
+++ b/modules/core/test/test_operations.cpp
@@ -75,6 +75,7 @@ protected:
bool TestVec();
bool TestMatxMultiplication();
bool TestSubMatAccess();
+ bool TestSVD();
bool operations1();
void checkDiff(const Mat& m1, const Mat& m2, const string& s)
@@ -934,6 +935,29 @@ bool CV_OperationsTest::operations1()
return true;
}
+
+bool CV_OperationsTest::TestSVD()
+{
+ try
+ {
+ Mat A = (Mat_(3,4) << 1, 2, -1, 4, 2, 4, 3, 5, -1, -2, 6, 7);
+ Mat x;
+ SVD::solveZ(A,x);
+ if( norm(A*x, CV_C) > FLT_EPSILON )
+ throw test_excep();
+
+ SVD svd(A, SVD::FULL_UV);
+ if( norm(A*svd.vt.row(3).t(), CV_C) > FLT_EPSILON )
+ throw test_excep();
+ }
+ catch(const test_excep&)
+ {
+ ts->set_failed_test_info(cvtest::TS::FAIL_MISMATCH);
+ return false;
+ }
+ return true;
+}
+
void CV_OperationsTest::run( int /* start_from */)
{
if (!TestMat())
@@ -959,6 +983,9 @@ void CV_OperationsTest::run( int /* start_from */)
if (!TestSubMatAccess())
return;
+
+ if (!TestSVD())
+ return;
if (!operations1())
return;
diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt
index 020abb2821..278ee8a806 100644
--- a/modules/java/CMakeLists.txt
+++ b/modules/java/CMakeLists.txt
@@ -248,9 +248,9 @@ if(ANDROID)
# build the library project
# normally we should do this after a native part, but for a library project we can build the java part first
add_custom_command(
- OUTPUT "${OpenCV_BINARY_DIR}/bin/classes.jar"
+ OUTPUT "${OpenCV_BINARY_DIR}/bin/classes.jar" "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper"
COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug
- COMMAND ${CMAKE_COMMAND} -E touch "${OpenCV_BINARY_DIR}/bin/classes.jar" # needed because ant does not update the timestamp of updated jar
+ COMMAND ${CMAKE_COMMAND} -E touch "${OpenCV_BINARY_DIR}/bin/.classes.jar.dephelper" # can not rely on classes.jar because different versions of SDK update timestamp at different times
WORKING_DIRECTORY "${OpenCV_BINARY_DIR}"
DEPENDS ${lib_proj_files} ${lib_target_files} ${java_files}
COMMENT "Building OpenCV Android library project"
diff --git a/modules/nonfree/CMakeLists.txt b/modules/nonfree/CMakeLists.txt
index 873532c3fb..8c7bd0efde 100644
--- a/modules/nonfree/CMakeLists.txt
+++ b/modules/nonfree/CMakeLists.txt
@@ -1,2 +1,6 @@
+if(BUILD_ANDROID_PACKAGE)
+ ocv_module_disable(nonfree)
+endif()
+
set(the_description "Functionality with possible limitations on the use")
ocv_define_module(nonfree opencv_imgproc opencv_features2d)
diff --git a/samples/cpp/filestorage.cpp b/samples/cpp/filestorage.cpp
index fa48fe63bf..45bf9fc6fb 100644
--- a/samples/cpp/filestorage.cpp
+++ b/samples/cpp/filestorage.cpp
@@ -150,7 +150,37 @@ int main(int ac, char** av)
}
- cout << "Try opening " << filename << " to see the serialized data." << endl;
+ cout << "Try opening " << filename << " to see the serialized data." << endl << endl;
+
+ //read from string
+ {
+ cout << "Read data from string\n";
+ string dataString =
+ "%YAML:1.0\n"
+ "mdata:\n"
+ " A: 97\n"
+ " X: 3.1415926535897931e+00\n"
+ " id: mydata1234\n";
+ MyData m;
+ FileStorage fs(dataString, FileStorage::READ | FileStorage::MEMORY);
+ cout << "attempting to read mdata_b from string\n"; //Show default behavior for empty matrix
+ fs["mdata"] >> m;
+ cout << "read mdata\n";
+ cout << m << endl;
+ }
+
+ //write to string
+ {
+ cout << "Write data to string\n";
+ FileStorage fs(filename, FileStorage::WRITE | FileStorage::MEMORY | FileStorage::FORMAT_YAML);
+
+ cout << "writing MyData struct\n";
+ MyData m(1);
+ fs << "mdata" << m;
+ cout << m << endl;
+ string createdString = fs.releaseAndGetString();
+ cout << "Created string:\n" << createdString << "\n";
+ }
return 0;
}