Merge release 2.4.3
This commit is contained in:
@@ -1 +1 @@
|
||||
See http://code.opencv.org/projects/opencv/wiki/OpenCV4Android
|
||||
See http://opencv.org/android
|
||||
|
39
android/libinfo/CMakeLists.txt
Normal file
39
android/libinfo/CMakeLists.txt
Normal file
@@ -0,0 +1,39 @@
|
||||
project(libopencv_info)
|
||||
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()
|
||||
|
||||
add_definitions(-DANDROID_PACKAGE_RELEASE=${ANDROID_PACKAGE_RELEASE} -DANDROID_PACKAGE_PLATFORM="${ANDROID_PACKAGE_PLATFORM}")
|
||||
|
||||
include_directories(jni/BinderComponent jni/include "${OpenCV_SOURCE_DIR}/modules/core/include")
|
||||
|
||||
add_library(opencv_info SHARED info.c)
|
||||
|
||||
set_target_properties(${the_module} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
|
||||
INSTALL_NAME_DIR lib
|
||||
)
|
||||
|
||||
get_filename_component(lib_name "opencv_info" NAME)
|
||||
install(FILES "${LIBRARY_OUTPUT_PATH}/${lib_name}" DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
31
android/libinfo/info.c
Normal file
31
android/libinfo/info.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "opencv2/core/version.hpp"
|
||||
#include <jni.h>
|
||||
|
||||
const char* GetPackageName(void);
|
||||
const char* GetRevision(void);
|
||||
const char* GetLibraryList(void);
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass);
|
||||
|
||||
#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" ANDROID_PACKAGE_PLATFORM
|
||||
#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) CVAUX_STR(ANDROID_PACKAGE_RELEASE)
|
||||
|
||||
const char* GetPackageName(void)
|
||||
{
|
||||
return PACKAGE_NAME;
|
||||
}
|
||||
|
||||
const char* GetRevision(void)
|
||||
{
|
||||
return PACKAGE_REVISION;
|
||||
}
|
||||
|
||||
const char* GetLibraryList(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
(void)clazz;
|
||||
return (*env)->NewStringUTF(env, GetLibraryList());
|
||||
}
|
@@ -10,11 +10,11 @@ HomeDir = os.getcwd()
|
||||
for s in ConfFile.readlines():
|
||||
s = s[0:s.find("#")]
|
||||
if (not s):
|
||||
continue
|
||||
continue
|
||||
keys = s.split(";")
|
||||
if (len(keys) < 4):
|
||||
print("Error: invalid config line: \"%s\"" % s)
|
||||
continue
|
||||
print("Error: invalid config line: \"%s\"" % s)
|
||||
continue
|
||||
MakeTarget = str.strip(keys[0])
|
||||
Arch = str.strip(keys[1])
|
||||
NativeApiLevel = str.strip(keys[2])
|
||||
@@ -22,37 +22,41 @@ for s in ConfFile.readlines():
|
||||
AndroidTreeRoot = str.strip(AndroidTreeRoot, "\n")
|
||||
print("Building %s for %s" % (MakeTarget, Arch))
|
||||
BuildDir = os.path.join(HomeDir, MakeTarget + "_" + Arch)
|
||||
|
||||
if (os.path.exists(BuildDir)):
|
||||
shutil.rmtree(BuildDir)
|
||||
shutil.rmtree(BuildDir)
|
||||
|
||||
try:
|
||||
os.mkdir(BuildDir)
|
||||
os.mkdir(BuildDir)
|
||||
except:
|
||||
print("Error: cannot create direcotry \"%s\"" % BuildDir)
|
||||
continue
|
||||
print("Error: cannot create direcotry \"%s\"" % BuildDir)
|
||||
continue
|
||||
|
||||
shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True)
|
||||
if (Arch == "x86"):
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
elif (Arch == "mips"):
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
else:
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
|
||||
os.chdir(BuildDir)
|
||||
BuildLog = os.path.join(BuildDir, "build.log")
|
||||
CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_USE_STLPORT=ON ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
|
||||
CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_STL=stlport_static ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
|
||||
MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
|
||||
#print(CmakeCmdLine)
|
||||
print(CmakeCmdLine)
|
||||
os.system(CmakeCmdLine)
|
||||
#print(MakeCmdLine)
|
||||
print(MakeCmdLine)
|
||||
os.system(MakeCmdLine)
|
||||
os.chdir(HomeDir)
|
||||
CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")
|
||||
if (os.path.exists(CameraLib)):
|
||||
try:
|
||||
shutil.copyfile(CameraLib, os.path.join("..", "3rdparty", "lib", Arch, "lib" + MakeTarget + ".so"))
|
||||
print("Building %s for %s\t[\033[92mOK\033[0m]" % (MakeTarget, Arch));
|
||||
except:
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
try:
|
||||
shutil.copyfile(CameraLib, os.path.join("..", "3rdparty", "lib", Arch, "lib" + MakeTarget + ".so"))
|
||||
print("Building %s for %s\t[\033[92mOK\033[0m]" % (MakeTarget, Arch));
|
||||
except:
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
else:
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
ConfFile.close()
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch));
|
||||
|
||||
ConfFile.close()
|
||||
|
@@ -4,5 +4,5 @@ cd `dirname $0`/..
|
||||
mkdir -p build_service
|
||||
cd build_service
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_USE_STLPORT=ON -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/2.2.2/ $@ ../..
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../..
|
||||
|
||||
|
Binary file not shown.
@@ -20,4 +20,4 @@ if (not os.path.exists(TARGET_PATH)):
|
||||
|
||||
for filename in os.listdir("."):
|
||||
if ("dia" == filename[-3:]):
|
||||
os.system("%s --export %s %s" % (DiaPath, os.path.join(TARGET_PATH, filename[0:len(filename)-4] + ".png"), filename))
|
||||
os.system("%s --export %s %s" % (DiaPath, os.path.join(TARGET_PATH, filename[0:len(filename)-4] + ".png"), filename))
|
Binary file not shown.
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 30 KiB |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.opencv.engine"
|
||||
android:versionCode="18"
|
||||
android:versionName="1.8" >
|
||||
android:versionCode="20"
|
||||
android:versionName="2.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
|
@@ -1,10 +1,16 @@
|
||||
set(engine OpenCVEngine)
|
||||
set(JNI_LIB_NAME ${engine} ${engine}_jni)
|
||||
|
||||
unset(__android_project_chain CACHE)
|
||||
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON)
|
||||
|
||||
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin_${ANDROID_ARCH_NAME}/system/lib")
|
||||
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
|
||||
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
|
||||
# -D__SUPPORT_ARMEABI_FEATURES key is also available
|
||||
add_definitions(-DPLATFORM_ANDROID -D__SUPPORT_ARMEABI_V7A_FEATURES -D__SUPPORT_TEGRA3 -D__SUPPORT_MIPS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
|
||||
file(GLOB engine_files "jni/BinderComponent/*.cpp" "jni/BinderComponent/*.h" "jni/include/*.h")
|
||||
|
||||
include_directories(jni/BinderComponent jni/include)
|
||||
|
@@ -130,7 +130,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
|
||||
LOGD("Trying to load info library \"%s\"", tmp.c_str());
|
||||
|
||||
void* handle;
|
||||
char* (*info_func)();
|
||||
const char* (*info_func)();
|
||||
|
||||
handle = dlopen(tmp.c_str(), RTLD_LAZY);
|
||||
if (handle)
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetCpuID(JNIEnv* env, jclass)
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetCpuID(JNIEnv* , jclass)
|
||||
{
|
||||
return GetCpuID();
|
||||
}
|
||||
@@ -14,12 +14,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_engine_HardwareDetector_GetPlatformNam
|
||||
return env->NewStringUTF(hardware_name.c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetProcessorCount(JNIEnv* env, jclass)
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_GetProcessorCount(JNIEnv* , jclass)
|
||||
{
|
||||
return GetProcessorCount();
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_DetectKnownPlatforms(JNIEnv* env, jclass)
|
||||
JNIEXPORT jint JNICALL Java_org_opencv_engine_HardwareDetector_DetectKnownPlatforms(JNIEnv* , jclass)
|
||||
{
|
||||
return DetectKnownPlatforms();
|
||||
}
|
@@ -30,7 +30,7 @@ JNIEXPORT jobject JNICALL Java_org_opencv_engine_BinderConnector_Connect(JNIEnv*
|
||||
return javaObjectForIBinder(env, OpenCVEngineBinder);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_engine_BinderConnector_Init(JNIEnv* env, jobject thiz, jobject market)
|
||||
JNIEXPORT jboolean JNICALL Java_org_opencv_engine_BinderConnector_Init(JNIEnv* env, jobject , jobject market)
|
||||
{
|
||||
LOGD("Java_org_opencv_engine_BinderConnector_Init");
|
||||
|
||||
|
@@ -363,7 +363,7 @@ InstallPath(install_path)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGE("Library loading error (%x, %x): \"%s\"", name_func, revision_func, error);
|
||||
LOGE("Library loading error (%p, %p): \"%s\"", name_func, revision_func, error);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#define LOG_TAG "OpenCVEngine"
|
||||
|
||||
#ifndef OPEN_CV_ENGINE_VERSION
|
||||
#define OPEN_CV_ENGINE_VERSION 1
|
||||
#define OPEN_CV_ENGINE_VERSION 2
|
||||
#endif
|
||||
|
||||
#define LIB_OPENCV_INFO_NAME "libopencv_info.so"
|
||||
|
Reference in New Issue
Block a user