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 09:29] – [android method 3] 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: | + | |
| - | * substitute / | + | |
| - | * android sdk in / | + | |
| - | + | ||
| - | < | + | |
| - | cd /opt | + | |
| - | git clone -b 3.4 --depth 1 https:// | + | |
| - | </ | + | |
| - | + | ||
| - | <file python platforms/ | + | |
| - | vars=dict(BUILD_ANDROID_PROJECTS=' | + | |
| - | + | ||
| - | ABIs = [ | + | |
| - | # | + | |
| - | # | + | |
| - | ABI(" | + | |
| - | ABI(" | + | |
| - | # | + | |
| - | ] | + | |
| - | </ | + | |
| - | + | ||
| - | create / | + | |
| - | < | + | |
| - | cd / | + | |
| - | python ./ | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | / | + | |
| - | </ | + | |
| - | + | ||
| - | ===== android method 2 ===== | + | |
| - | + | ||
| - | Thank you to everyone for your help. | + | |
| - | + | ||
| - | 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: | + | |
| - | + | ||
| - | < | + | |
| - | $ mkdir ~/sdk && cd ~/sdk | + | |
| - | $ wget https:// | + | |
| - | $ tools/ | + | |
| - | Select and install the following two packages: | + | |
| - | Android SDK Build-tools 27.0.3 | + | |
| - | Android 8.1.0 (API 27) -> SDK Platform 27 | + | |
| - | $ mkdir ~/opencv && cd ~/opencv | + | |
| - | $ 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=" | + | |
| - | + | ||
| - | 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' | + | |
| - | + | ||
| - | ===== android method 3 ===== | + | |
| prereq: | prereq: | ||
| Line 168: | Line 108: | ||
| cd platform/ | cd platform/ | ||
| + | |||
| + | # edit ndk-16.config.py | ||
| + | # ABI(" | ||
| + | |||
| ANDROID_SDK=${BASE} ANDROID_HOME=${BASE} ./ | ANDROID_SDK=${BASE} ANDROID_HOME=${BASE} ./ | ||
| --force_opencv_toolchain \ | --force_opencv_toolchain \ | ||
| Line 174: | Line 118: | ||
| ${BASE}/ | ${BASE}/ | ||
| </ | </ | ||
| + | |||
| + | To compile against libc++, I then changed ANDROID_STL=" | ||
| + | |||
| + | @ngriffiths you need to strip out intel threading libs (TBB). That' | ||
| + | |||