Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tips:opencv:install [2018/06/12 07:59] – scipio | tips:opencv:install [2018/06/13 09:06] (current) – scipio | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== opencv install ====== | ====== opencv install ====== | ||
+ | |||
+ | ===== android studio ===== | ||
+ | |||
+ | [[https:// | ||
===== linux ===== | ===== linux ===== | ||
Line 76: | Line 80: | ||
</ | </ | ||
- | ===== android | + | ===== android ===== |
prereq: | prereq: | ||
- | * substitute /opt/android-sdk/tools with https:// | + | * android |
- | * android sdk in / | + | |
+ | Download a stub android sdk and opencv sources | ||
< | < | ||
- | cd /opt | + | # adjust these paths ## |
- | git clone -b 3.4 --depth 1 https:// | + | REAL_ANDROID_SDK=/opt/ |
- | </ | + | # output builded opencv, can be removed after |
+ | BASE=/ | ||
+ | ####################### | ||
- | <file python platforms/android/ndk.config.py> | + | mkdir -p ${BASE} |
- | vars=dict(BUILD_ANDROID_PROJECTS=' | + | cd ${BASE} |
+ | wget https:// | ||
+ | unzip tools_r25.2.5-linux.zip | ||
+ | tool/ | ||
+ | Select and install the following two packages: | ||
+ | Android SDK Build-tools 27.0.3 | ||
+ | Android 8.1.0 (API 27) -> SDK Platform | ||
- | ABIs = [ | + | git clone --depth 1 https:// |
- | # | + | cd opencv |
- | # | + | wget https:// |
- | ABI(" | + | git apply always-use-ant__find_android.patch |
- | | + | |
- | # | + | |
- | ] | + | |
- | </ | + | |
- | create / | + | cd platform/android |
- | < | + | |
- | cd / | + | |
- | python ./platforms/android/ | + | |
- | | + | |
- | | + | |
- | | + | |
- | / | + | |
- | </ | + | |
- | ===== android | + | # edit ndk-16.config.py |
+ | # ABI(" | ||
- | Thank you to everyone for your help. | + | ANDROID_SDK=${BASE} ANDROID_HOME=${BASE} |
- | + | --force_opencv_toolchain \ | |
- | I recently had to build OpenCV for Android from source (because I wanted to link against LLVM libc++ STL instead of GNU STL). In case it’s useful to anyone else, here are some quick instructions on how I did it: | + | --ndk_path |
- | + | --config ndk-16.config.py | |
- | < | + | ${BASE}/build |
- | | + | |
- | | + | |
- | $ tools/ | + | |
- | Select and install the following two packages: | + | |
- | Android SDK Build-tools 27.0.3 | + | |
- | Android 8.1.0 (API 27) -> SDK Platform 27 | + | |
- | | + | |
- | $ git clone https:// | + | |
- | $ cd ~/ | + | |
- | $ wget https:// | + | |
- | $ cd platforms/ | + | |
- | $ ANDROID_SDK=~/ | + | |
</ | </ | ||
- | I already had the ANDROID_NDK environment variable set to a local NDK 16 installation. | + | To compile against libc++, I then changed ANDROID_STL=" |
- | + | ||
- | To compile against libc++, I then changed ANDROID_STL=" | + | |
- | + | ||
- | One unusual thing I couldn’t work out was why the static libs I built were much larger than those in the official distribution (e.g. my arm64-v8a/ | + | |
- | @peterchaula | + | |
- | peterchaula commented on Apr 11 | + | |
@ngriffiths you need to strip out intel threading libs (TBB). That' | @ngriffiths you need to strip out intel threading libs (TBB). That' | ||
- | |||