Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4d17051f
Commit
4d17051f
authored
Sep 16, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android: backport Android SDK build script
parent
9285dddb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
3 deletions
+39
-3
OpenCVDetectAndroidSDK.cmake
cmake/OpenCVDetectAndroidSDK.cmake
+12
-0
OpenCV.mk.in
cmake/templates/OpenCV.mk.in
+4
-0
android+OpenCVLoader.java
modules/java/generator/src/java/android+OpenCVLoader.java
+13
-0
build_sdk.py
platforms/android/build_sdk.py
+0
-0
CMakeLists.txt
platforms/android/service/CMakeLists.txt
+0
-2
JavaHelper.rst
platforms/android/service/doc/JavaHelper.rst
+8
-0
readme.txt
platforms/android/service/readme.txt
+2
-0
Android.mk
samples/android/face-detection/jni/Android.mk
+0
-1
No files found.
cmake/OpenCVDetectAndroidSDK.cmake
View file @
4d17051f
...
...
@@ -274,6 +274,17 @@ macro(add_android_project target path)
file
(
GLOB_RECURSE android_proj_jni_files
"
${
path
}
/jni/*.c"
"
${
path
}
/jni/*.h"
"
${
path
}
/jni/*.cpp"
"
${
path
}
/jni/*.hpp"
)
ocv_list_filterout
(
android_proj_jni_files
"
\\\\
.svn"
)
foreach
(
lib
"opencv_java"
)
get_property
(
f TARGET
${
lib
}
PROPERTY LOCATION
)
get_filename_component
(
f_name
${
f
}
NAME
)
add_custom_command
(
OUTPUT
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
/
${
f_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy
"
${
f
}
"
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
/
${
f_name
}
"
DEPENDS
"
${
lib
}
"
VERBATIM
COMMENT
"Embedding
${
f
}
"
)
list
(
APPEND android_proj_file_deps
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
/
${
f_name
}
"
)
endforeach
()
if
(
android_proj_jni_files AND EXISTS
${
path
}
/jni/Android.mk AND NOT DEFINED JNI_LIB_NAME
)
# find local module name in Android.mk file to build native lib
file
(
STRINGS
"
${
path
}
/jni/Android.mk"
JNI_LIB_NAME REGEX
"LOCAL_MODULE[ ]*:=[ ]*.*"
)
...
...
@@ -307,6 +318,7 @@ macro(add_android_project target path)
# copy opencv_java, tbb if it is shared and dynamicuda if present if FORCE_EMBED_OPENCV flag is set
if
(
android_proj_FORCE_EMBED_OPENCV
)
set
(
native_deps
${
android_proj_NATIVE_DEPS
}
)
list
(
REMOVE_ITEM native_deps
"opencv_java"
)
# filter out gpu module as it is always static library on Android
list
(
REMOVE_ITEM native_deps
"opencv_gpu"
)
if
(
ENABLE_DYNAMIC_CUDA
)
...
...
cmake/templates/OpenCV.mk.in
View file @
4d17051f
...
...
@@ -110,6 +110,10 @@ else
OPENCV_INSTALL_MODULES:=on
endif
ifeq ($(OPENCV_INSTALL_MODULES),)
OPENCV_INSTALL_MODULES:=on
endif
define add_opencv_module
include $(CLEAR_VARS)
LOCAL_MODULE:=opencv_$1
...
...
modules/java/generator/src/java/android+OpenCVLoader.java
View file @
4d17051f
package
org
.
opencv
.
android
;
import
android.content.Context
;
import
android.util.Log
;
/**
* Helper class provides common initialization methods for OpenCV library.
*/
public
class
OpenCVLoader
{
private
static
final
String
TAG
=
"OpenCVLoader"
;
/**
* OpenCV Library version 2.4.2.
*/
...
...
@@ -62,6 +65,11 @@ public class OpenCVLoader
*/
public
static
final
String
OPENCV_VERSION_2_4_12
=
"2.4.12"
;
/**
* OpenCV Library version 2.4.13.
*/
public
static
final
String
OPENCV_VERSION_2_4_13
=
"2.4.13"
;
/**
* 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.
...
...
@@ -91,6 +99,11 @@ public class OpenCVLoader
public
static
boolean
initAsync
(
String
Version
,
Context
AppContext
,
LoaderCallbackInterface
Callback
)
{
if
(
initDebug
())
{
Callback
.
onManagerConnected
(
LoaderCallbackInterface
.
SUCCESS
);
return
true
;
}
Log
.
w
(
TAG
,
"OpenCV binaries are not packaged with application. Trying to use OpenCV Manager..."
);
return
AsyncServiceHelper
.
initOpenCV
(
Version
,
AppContext
,
Callback
);
}
}
platforms/android/build_sdk.py
100755 → 100644
View file @
4d17051f
This diff is collapsed.
Click to expand it.
platforms/android/service/CMakeLists.txt
View file @
4d17051f
...
...
@@ -2,5 +2,3 @@ if(BUILD_ANDROID_SERVICE)
add_subdirectory
(
engine
)
#add_subdirectory(engine_test)
endif
()
install
(
FILES
"readme.txt"
DESTINATION
"apk/"
COMPONENT libs
)
platforms/android/service/doc/JavaHelper.rst
View file @
4d17051f
...
...
@@ -79,3 +79,11 @@ OpenCV version constants
.. data:: OPENCV_VERSION_2_4_11
OpenCV Library version 2.4.11
.. data:: OPENCV_VERSION_2_4_12
OpenCV Library version 2.4.12
.. data:: OPENCV_VERSION_2_4_13
OpenCV Library version 2.4.13
platforms/android/service/readme.txt
View file @
4d17051f
How to select the proper version of OpenCV Manager
--------------------------------------------------
DEPRECATED: This information is outdated since OpenCV 2.4.12
Since version 1.7 several packages of OpenCV Manager are built. Every package is targeted for some
specific hardware platform and includes corresponding OpenCV binaries. So, in most cases OpenCV
Manager uses built-in version of OpenCV. Separate package with OpenCV binaries is currently used in
...
...
samples/android/face-detection/jni/Android.mk
View file @
4d17051f
...
...
@@ -3,7 +3,6 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
#OPENCV_LIB_TYPE:=SHARED
include ../../sdk/native/jni/OpenCV.mk
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment