Merge pull request #3847 from mshabunin:android-build
This commit is contained in:
commit
77cbddf715
@ -82,7 +82,7 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
|
|||||||
// Using OpenCV Manager for initialization;
|
// Using OpenCV Manager for initialization;
|
||||||
|
|
||||||
Log("Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log("Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, getContext(), mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, getContext(), mLoaderCallback);
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
try {
|
try {
|
||||||
|
@ -47,6 +47,22 @@ public class OpenCVLoader
|
|||||||
*/
|
*/
|
||||||
public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
|
public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenCV Library version 2.4.10.
|
||||||
|
*/
|
||||||
|
public static final String OPENCV_VERSION_2_4_10 = "2.4.10";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenCV Library version 2.4.11.
|
||||||
|
*/
|
||||||
|
public static final String OPENCV_VERSION_2_4_11 = "2.4.11";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenCV Library version 3.0.0.
|
||||||
|
*/
|
||||||
|
public static final String OPENCV_VERSION_3_0_0 = "3.0.0";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
|
* Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
|
||||||
* @return Returns true is initialization of OpenCV was successful.
|
* @return Returns true is initialization of OpenCV was successful.
|
||||||
|
@ -1 +1 @@
|
|||||||
See http://opencv.org/android
|
See http://opencv.org/platforms/android.html
|
||||||
|
@ -23,6 +23,9 @@ if(NOT ANDROID_PACKAGE_PLATFORM)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE "-fvisibility=hidden" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
|
string(REPLACE "-fvisibility-inlines-hidden" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
|
|
||||||
add_definitions(-DANDROID_PACKAGE_RELEASE=${ANDROID_PACKAGE_RELEASE} -DANDROID_PACKAGE_PLATFORM="${ANDROID_PACKAGE_PLATFORM}")
|
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")
|
include_directories(jni/BinderComponent jni/include "${OpenCV_SOURCE_DIR}/modules/core/include")
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.opencv.engine"
|
package="org.opencv.engine"
|
||||||
android:versionCode="218@ANDROID_PLATFORM_VERSION_CODE@"
|
android:versionCode="300@ANDROID_PLATFORM_VERSION_CODE@"
|
||||||
android:versionName="2.18" >
|
android:versionName="3.00" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
|
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
|
||||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||||
@ -27,4 +27,4 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -12,14 +12,16 @@ if(ARMEABI_V7A)
|
|||||||
else()
|
else()
|
||||||
set(ANDROID_PLATFORM_VERSION_CODE "3")
|
set(ANDROID_PLATFORM_VERSION_CODE "3")
|
||||||
endif()
|
endif()
|
||||||
|
elseif(ARM64_V8A)
|
||||||
|
set(ANDROID_PLATFORM_VERSION_CODE "4")
|
||||||
elseif(ARMEABI_V6)
|
elseif(ARMEABI_V6)
|
||||||
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
||||||
elseif(ARMEABI)
|
elseif(ARMEABI)
|
||||||
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
||||||
elseif(X86)
|
elseif(X86)
|
||||||
set(ANDROID_PLATFORM_VERSION_CODE "4")
|
|
||||||
elseif(MIPS)
|
|
||||||
set(ANDROID_PLATFORM_VERSION_CODE "5")
|
set(ANDROID_PLATFORM_VERSION_CODE "5")
|
||||||
|
elseif(MIPS)
|
||||||
|
set(ANDROID_PLATFORM_VERSION_CODE "6")
|
||||||
else()
|
else()
|
||||||
message(WARNING "Can not automatically determine the value for ANDROID_PLATFORM_VERSION_CODE")
|
message(WARNING "Can not automatically determine the value for ANDROID_PLATFORM_VERSION_CODE")
|
||||||
endif()
|
endif()
|
||||||
@ -47,6 +49,8 @@ endif()
|
|||||||
add_definitions(-DPLATFORM_ANDROID -D__SUPPORT_ARMEABI_V7A_FEATURES -D__SUPPORT_TEGRA3 -D__SUPPORT_MIPS)
|
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_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-allow-shlib-undefined")
|
||||||
|
string(REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE "-fvisibility-inlines-hidden" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
include_directories("jni/BinderComponent" "jni/include")
|
include_directories("jni/BinderComponent" "jni/include")
|
||||||
include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
|
include_directories(SYSTEM "${ANDROID_SOURCE_TREE}/frameworks/base/include" "${ANDROID_SOURCE_TREE}/system/core/include")
|
||||||
|
@ -39,44 +39,63 @@ int GetCpuID()
|
|||||||
#else
|
#else
|
||||||
result = ARCH_UNKNOWN;
|
result = ARCH_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#ifdef __SUPPORT_AARCH64
|
||||||
|
result |= ARCH_AARCH64;
|
||||||
#else
|
#else
|
||||||
|
result = ARCH_UNKNOWN;
|
||||||
|
#endif
|
||||||
|
#elif defined(__arm__)
|
||||||
LOGD("Using ARM HW detector");
|
LOGD("Using ARM HW detector");
|
||||||
it = cpu_info.find("Processor");
|
it = cpu_info.find("Processor");
|
||||||
|
|
||||||
if (cpu_info.end() != it)
|
if (cpu_info.end() != it)
|
||||||
{
|
{
|
||||||
size_t proc_name_pos = it->second.find(CPU_INFO_ARCH_X86_STR);
|
size_t proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV7_STR);
|
||||||
if (string::npos != proc_name_pos)
|
if (string::npos != proc_name_pos)
|
||||||
{
|
{
|
||||||
|
result |= ARCH_ARMv7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV7_STR);
|
proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV6_STR);
|
||||||
if (string::npos != proc_name_pos)
|
if (string::npos != proc_name_pos)
|
||||||
{
|
{
|
||||||
result |= ARCH_ARMv7;
|
result |= ARCH_ARMv6;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV6_STR);
|
proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV5_STR);
|
||||||
if (string::npos != proc_name_pos)
|
if (string::npos != proc_name_pos)
|
||||||
{
|
{
|
||||||
result |= ARCH_ARMv6;
|
result |= ARCH_ARMv5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
proc_name_pos = it->second.find(CPU_INFO_ARCH_ARMV5_STR);
|
// Treat the arch of current binary. Google Play checks
|
||||||
if (string::npos != proc_name_pos)
|
// device hardware before installation. Let's assume that
|
||||||
{
|
// if the binary works, it's compatible with current hardware
|
||||||
result |= ARCH_ARMv5;
|
#if defined __ARM_ARCH_7A__
|
||||||
}
|
result |= ARCH_ARMv7;
|
||||||
|
result |= FEATURES_HAS_VFPv3d16;
|
||||||
|
#else
|
||||||
|
result |= ARCH_ARMv5;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ARCH_UNKNOWN;
|
// Treat the arch of current binary. Google Play checks
|
||||||
|
// device hardware before installation. Let's assume that
|
||||||
|
// if the binary works, it's compatible with current hardware
|
||||||
|
#if defined __ARM_ARCH_7A__
|
||||||
|
result |= ARCH_ARMv7;
|
||||||
|
result |= FEATURES_HAS_VFPv3;
|
||||||
|
#else
|
||||||
|
result |= ARCH_ARMv5;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
it = cpu_info.find("Features");
|
it = cpu_info.find("Features");
|
||||||
@ -107,7 +126,9 @@ int GetCpuID()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#else
|
||||||
|
result = ARCH_UNKNOWN;
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#define ARCH_ARMv5 67108864L
|
#define ARCH_ARMv5 67108864L
|
||||||
#define ARCH_ARMv6 134217728L
|
#define ARCH_ARMv6 134217728L
|
||||||
#define ARCH_ARMv7 268435456L
|
#define ARCH_ARMv7 268435456L
|
||||||
#define ARCH_ARMv8 536870912L
|
#define ARCH_AARCH64 536870912L
|
||||||
#define ARCH_MIPS 1073741824L
|
#define ARCH_MIPS 1073741824L
|
||||||
|
|
||||||
#define FEATURES_HAS_VFPv3d16 1L
|
#define FEATURES_HAS_VFPv3d16 1L
|
||||||
|
@ -15,7 +15,7 @@ using namespace android;
|
|||||||
|
|
||||||
const int OpenCVEngine::Platform = DetectKnownPlatforms();
|
const int OpenCVEngine::Platform = DetectKnownPlatforms();
|
||||||
const int OpenCVEngine::CpuID = GetCpuID();
|
const int OpenCVEngine::CpuID = GetCpuID();
|
||||||
const int OpenCVEngine::KnownVersions[] = {2040000, 2040100, 2040200, 2040300, 2040301, 2040302, 2040400, 2040500, 2040600, 2040700, 2040701, 2040800, 2040900};
|
const int OpenCVEngine::KnownVersions[] = {2040000, 2040100, 2040200, 2040300, 2040301, 2040302, 2040400, 2040500, 2040600, 2040700, 2040701, 2040800, 2040900, 2041000, 2041100, 3000000};
|
||||||
|
|
||||||
bool OpenCVEngine::ValidateVersion(int version)
|
bool OpenCVEngine::ValidateVersion(int version)
|
||||||
{
|
{
|
||||||
|
@ -208,6 +208,11 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
|
|||||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv4 | FEATURES_HAS_NEON));
|
result.push_back(std::pair<int, int>(PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv4 | FEATURES_HAS_NEON));
|
||||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA5, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv4 | FEATURES_HAS_NEON));
|
result.push_back(std::pair<int, int>(PLATFORM_TEGRA5, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv4 | FEATURES_HAS_NEON));
|
||||||
|
|
||||||
|
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_AARCH64));
|
||||||
|
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_AARCH64 | FEATURES_HAS_VFPv3));
|
||||||
|
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_AARCH64 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv4));
|
||||||
|
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_AARCH64 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,20 +302,13 @@ PackageInfo::PackageInfo(int version, int platform, int cpu_id, std::string inst
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (ARCH_ARMv8 & CpuID)
|
#ifdef __SUPPORT_AARCH64
|
||||||
|
else if (ARCH_AARCH64 & CpuID)
|
||||||
{
|
{
|
||||||
LOGD("PackageInfo::PackageInfo: package arch ARMv8");
|
LOGD("PackageInfo::PackageInfo: package arch AARCH64");
|
||||||
#ifdef __SUPPORT_ARMEABI_V8
|
FullName += string("_") + ARCH_AARCH64_NAME;
|
||||||
FullName += string("_") + ARCH_ARMv8_NAME;
|
|
||||||
#else
|
|
||||||
FullName += string("_") + ARCH_ARMv7_NAME;
|
|
||||||
#endif
|
|
||||||
//string features = JoinARMFeatures(CpuID);
|
|
||||||
//if (!features.empty())
|
|
||||||
//{
|
|
||||||
// FullName += string("_") + features;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef __SUPPORT_MIPS
|
#ifdef __SUPPORT_MIPS
|
||||||
else if (ARCH_MIPS & CpuID)
|
else if (ARCH_MIPS & CpuID)
|
||||||
{
|
{
|
||||||
@ -460,14 +453,22 @@ InstallPath(install_path)
|
|||||||
{
|
{
|
||||||
CpuID = ARCH_ARMv7 | SplitARMFeatures(features);
|
CpuID = ARCH_ARMv7 | SplitARMFeatures(features);
|
||||||
}
|
}
|
||||||
|
#ifdef __SUPPORT_AARCH64
|
||||||
|
else if (ARCH_AARCH64_NAME == features[2])
|
||||||
|
{
|
||||||
|
CpuID = ARCH_AARCH64 | SplitARMFeatures(features);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else if (ARCH_X86_NAME == features[2])
|
else if (ARCH_X86_NAME == features[2])
|
||||||
{
|
{
|
||||||
CpuID = ARCH_X86 | SplitIntelFeatures(features);
|
CpuID = ARCH_X86 | SplitIntelFeatures(features);
|
||||||
}
|
}
|
||||||
|
#ifdef __SUPPORT_INTEL_x64
|
||||||
else if (ARCH_X64_NAME == features[2])
|
else if (ARCH_X64_NAME == features[2])
|
||||||
{
|
{
|
||||||
CpuID = ARCH_X64 | SplitIntelFeatures(features);
|
CpuID = ARCH_X64 | SplitIntelFeatures(features);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#ifdef __SUPPORT_MIPS
|
#ifdef __SUPPORT_MIPS
|
||||||
else if (ARCH_MIPS_NAME == features[2])
|
else if (ARCH_MIPS_NAME == features[2])
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#define ARCH_ARMv5_NAME "armv5"
|
#define ARCH_ARMv5_NAME "armv5"
|
||||||
#define ARCH_ARMv6_NAME "armv6"
|
#define ARCH_ARMv6_NAME "armv6"
|
||||||
#define ARCH_ARMv7_NAME "armv7a"
|
#define ARCH_ARMv7_NAME "armv7a"
|
||||||
#define ARCH_ARMv8_NAME "armv8"
|
#define ARCH_AARCH64_NAME "aarch64"
|
||||||
|
|
||||||
#define FEATURES_HAS_VFPv3d16_NAME "vfpv3d16"
|
#define FEATURES_HAS_VFPv3d16_NAME "vfpv3d16"
|
||||||
#define FEATURES_HAS_VFPv3_NAME "vfpv3"
|
#define FEATURES_HAS_VFPv3_NAME "vfpv3"
|
||||||
|
@ -146,11 +146,19 @@ TEST(CpuID, CheckMips)
|
|||||||
EXPECT_TRUE(cpu_id & ARCH_MIPS);
|
EXPECT_TRUE(cpu_id & ARCH_MIPS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
TEST(CpuID, CheckAarch64)
|
||||||
|
{
|
||||||
|
int cpu_id = GetCpuID();
|
||||||
|
EXPECT_TRUE(cpu_id & ARCH_AARCH64);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
# if defined(__arm__) && defined(USE_TEGRA_HW_DETECTOR)
|
||||||
TEST(TegraDetector, Detect)
|
TEST(TegraDetector, Detect)
|
||||||
{
|
{
|
||||||
EXPECT_TRUE(DetectTegra() != 0);
|
EXPECT_TRUE(DetectTegra() != 0);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
TEST(CpuID, CheckArmV7)
|
TEST(CpuID, CheckArmV7)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,13 @@ TEST(PackageInfo, FullNameArmv7VFPv3Neon)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(PackageInfo, FullNameAarch64)
|
||||||
|
{
|
||||||
|
PackageInfo info(2041000, PLATFORM_UNKNOWN, ARCH_AARCH64);
|
||||||
|
string name = info.GetFullName();
|
||||||
|
EXPECT_STREQ("org.opencv.lib_v24_aarch64", name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(PackageInfo, FullNameArmv5)
|
TEST(PackageInfo, FullNameArmv5)
|
||||||
{
|
{
|
||||||
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv5);
|
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_ARMv5);
|
||||||
|
@ -54,6 +54,16 @@ TEST(PackageManager, GetPackagePathForArmv7)
|
|||||||
EXPECT_STREQ("/data/data/org.opencv.lib_v23_armv7a/lib", path.c_str());
|
EXPECT_STREQ("/data/data/org.opencv.lib_v23_armv7a/lib", path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __SUPPORT_AARCH64
|
||||||
|
TEST(PackageManager, GetPackagePathForAarch64)
|
||||||
|
{
|
||||||
|
PackageManagerStub pm;
|
||||||
|
EXPECT_TRUE(pm.InstallVersion(2041100, PLATFORM_UNKNOWN, ARCH_AARCH64));
|
||||||
|
string path = pm.GetPackagePathByVersion(2041100, PLATFORM_UNKNOWN, ARCH_AARCH64);
|
||||||
|
EXPECT_STREQ("/data/data/org.opencv.lib_v24_aarch64/lib", path.c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(PackageManager, GetPackagePathForArmv7Neon)
|
TEST(PackageManager, GetPackagePathForArmv7Neon)
|
||||||
{
|
{
|
||||||
PackageManagerStub pm;
|
PackageManagerStub pm;
|
||||||
|
@ -10,7 +10,7 @@ public class HardwareDetector
|
|||||||
public static final int ARCH_ARMv5 = 0x04000000;
|
public static final int ARCH_ARMv5 = 0x04000000;
|
||||||
public static final int ARCH_ARMv6 = 0x08000000;
|
public static final int ARCH_ARMv6 = 0x08000000;
|
||||||
public static final int ARCH_ARMv7 = 0x10000000;
|
public static final int ARCH_ARMv7 = 0x10000000;
|
||||||
public static final int ARCH_ARMv8 = 0x20000000;
|
public static final int ARCH_AARCH64 = 0x20000000;
|
||||||
|
|
||||||
public static final int ARCH_MIPS = 0x40000000;
|
public static final int ARCH_MIPS = 0x40000000;
|
||||||
// Platform specific features
|
// Platform specific features
|
||||||
|
@ -7,6 +7,7 @@ import java.util.StringTokenizer;
|
|||||||
import org.opencv.engine.HardwareDetector;
|
import org.opencv.engine.HardwareDetector;
|
||||||
import org.opencv.engine.MarketConnector;
|
import org.opencv.engine.MarketConnector;
|
||||||
import org.opencv.engine.OpenCVEngineInterface;
|
import org.opencv.engine.OpenCVEngineInterface;
|
||||||
|
import org.opencv.engine.OpenCVEngineService;
|
||||||
import org.opencv.engine.OpenCVLibraryInfo;
|
import org.opencv.engine.OpenCVLibraryInfo;
|
||||||
import org.opencv.engine.R;
|
import org.opencv.engine.R;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
@ -140,11 +141,11 @@ public class ManagerActivity extends Activity
|
|||||||
}
|
}
|
||||||
else if ((CpuId & HardwareDetector.ARCH_ARMv7) == HardwareDetector.ARCH_ARMv7)
|
else if ((CpuId & HardwareDetector.ARCH_ARMv7) == HardwareDetector.ARCH_ARMv7)
|
||||||
{
|
{
|
||||||
HardwarePlatformView.setText("ARM v7 " + JoinArmFeatures(CpuId));
|
HardwarePlatformView.setText("ARM v7a " + JoinArmFeatures(CpuId));
|
||||||
}
|
}
|
||||||
else if ((CpuId & HardwareDetector.ARCH_ARMv8) == HardwareDetector.ARCH_ARMv8)
|
else if ((CpuId & HardwareDetector.ARCH_AARCH64) == HardwareDetector.ARCH_AARCH64)
|
||||||
{
|
{
|
||||||
HardwarePlatformView.setText("ARM v8 " + JoinArmFeatures(CpuId));
|
HardwarePlatformView.setText("AARCH64 (ARM64 v8a) " + JoinArmFeatures(CpuId));
|
||||||
}
|
}
|
||||||
else if ((CpuId & HardwareDetector.ARCH_MIPS) == HardwareDetector.ARCH_MIPS)
|
else if ((CpuId & HardwareDetector.ARCH_MIPS) == HardwareDetector.ARCH_MIPS)
|
||||||
{
|
{
|
||||||
@ -220,7 +221,8 @@ public class ManagerActivity extends Activity
|
|||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Log.d("OpenCVManager/Receiver", "Broadcast message " + intent.getAction() + " receiver");
|
Log.d("OpenCVManager/Receiver", "Broadcast message " + intent.getAction() + " receiver");
|
||||||
Log.d("OpenCVManager/Receiver", "Filling package list on broadcast message");
|
Log.d("OpenCVManager/Receiver", "Filling package list on broadcast message");
|
||||||
if (!bindService(new Intent("org.opencv.engine.BIND"), new OpenCVEngineServiceConnection(), Context.BIND_AUTO_CREATE))
|
if (!bindService(new Intent("org.opencv.engine.BIND"),
|
||||||
|
new OpenCVEngineServiceConnection(), Context.BIND_AUTO_CREATE))
|
||||||
{
|
{
|
||||||
TextView EngineVersionView = (TextView)findViewById(R.id.EngineVersionValue);
|
TextView EngineVersionView = (TextView)findViewById(R.id.EngineVersionValue);
|
||||||
EngineVersionView.setText("not avaliable");
|
EngineVersionView.setText("not avaliable");
|
||||||
@ -251,7 +253,7 @@ public class ManagerActivity extends Activity
|
|||||||
if (HardwareDetector.mIsReady) {
|
if (HardwareDetector.mIsReady) {
|
||||||
Log.d(TAG, "Filling package list on resume");
|
Log.d(TAG, "Filling package list on resume");
|
||||||
OpenCVEngineServiceConnection connection = new OpenCVEngineServiceConnection();
|
OpenCVEngineServiceConnection connection = new OpenCVEngineServiceConnection();
|
||||||
if (!bindService(new Intent("org.opencv.engine.BIND"), connection, Context.BIND_AUTO_CREATE)) {
|
if (!bindService(new Intent(this, OpenCVEngineService.class), connection, Context.BIND_AUTO_CREATE)) {
|
||||||
Log.e(TAG, "Cannot bind to OpenCV Manager service!");
|
Log.e(TAG, "Cannot bind to OpenCV Manager service!");
|
||||||
TextView EngineVersionView = (TextView)findViewById(R.id.EngineVersionValue);
|
TextView EngineVersionView = (TextView)findViewById(R.id.EngineVersionValue);
|
||||||
if (EngineVersionView != null)
|
if (EngineVersionView != null)
|
||||||
@ -304,6 +306,9 @@ public class ManagerActivity extends Activity
|
|||||||
path = EngineService.getLibPathByVersion("2.5");
|
path = EngineService.getLibPathByVersion("2.5");
|
||||||
Log.d(TAG, "2.5 -> " + path);
|
Log.d(TAG, "2.5 -> " + path);
|
||||||
mActivePackageMap.put("25", path);
|
mActivePackageMap.put("25", path);
|
||||||
|
path = EngineService.getLibPathByVersion("3.0");
|
||||||
|
Log.d(TAG, "3.0 -> " + path);
|
||||||
|
mActivePackageMap.put("30", path);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -78,7 +78,7 @@ public class Puzzle15Activity extends Activity implements CvCameraViewListener,
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -94,7 +94,7 @@ public class CameraCalibrationActivity extends Activity implements CvCameraViewL
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -90,7 +90,7 @@ public class ColorBlobDetectionActivity extends Activity implements OnTouchListe
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -142,7 +142,7 @@ public class FdActivity extends Activity implements CvCameraViewListener2 {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -113,7 +113,7 @@ public class ImageManipulationsActivity extends Activity implements CvCameraView
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -41,7 +41,7 @@ public class CvNativeActivity extends Activity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -78,7 +78,7 @@ public class Tutorial1Activity extends Activity implements CvCameraViewListener2
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -99,7 +99,7 @@ public class Tutorial2Activity extends Activity implements CvCameraViewListener2
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
@ -90,7 +90,7 @@ public class Tutorial3Activity extends Activity implements CvCameraViewListener2
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
if (!OpenCVLoader.initDebug()) {
|
if (!OpenCVLoader.initDebug()) {
|
||||||
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
|
||||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
Log.d(TAG, "OpenCV library found inside package. Using it!");
|
||||||
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
|
||||||
|
Loading…
Reference in New Issue
Block a user