This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tips:opencv:install [2018/06/11 10:13] – scipio | tips:opencv:install [2018/06/13 09:06] (current) – scipio | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== opencv install ====== | ====== opencv install ====== | ||
| - | prereq: ubuntu 16:04 and... | + | ===== android studio ===== |
| + | |||
| + | [[https:// | ||
| + | |||
| + | ===== linux ===== | ||
| + | |||
| + | prereq: ubuntu 16:04 or 18:04 | ||
| <code bash> | <code bash> | ||
| sudo apt-get install -y build-essential cmake | sudo apt-get install -y build-essential cmake | ||
| Line 60: | Line 66: | ||
| # cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_JASPER=OFF -DWITH_OPENCL=ON .. | # cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_JASPER=OFF -DWITH_OPENCL=ON .. | ||
| # with openCL and CUDA | # with openCL and CUDA | ||
| - | cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_JASPER=OFF -DWITH_OPENCL=ON -DWITH_CUDA=ON .. | + | #cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_JASPER=OFF -DWITH_OPENCL=ON -DWITH_CUDA=ON |
| + | cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/ | ||
| time make -j4 | time make -j4 | ||
| Line 72: | Line 79: | ||
| sudo ldconfig | sudo ldconfig | ||
| </ | </ | ||
| + | |||
| + | ===== android ===== | ||
| + | |||
| + | prereq: | ||
| + | * android SDK in REAL_ANDROID_SDK (REAL_ANDROID_SDK=/ | ||
| + | |||
| + | Download a stub android sdk and opencv sources | ||
| + | < | ||
| + | # adjust these paths ## | ||
| + | REAL_ANDROID_SDK=/ | ||
| + | # output builded opencv, can be removed after | ||
| + | BASE=/ | ||
| + | ####################### | ||
| + | |||
| + | mkdir -p ${BASE} | ||
| + | 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 | ||
| + | |||
| + | git clone --depth 1 https:// | ||
| + | cd opencv | ||
| + | wget https:// | ||
| + | git apply always-use-ant__find_android.patch | ||
| + | |||
| + | cd platform/ | ||
| + | |||
| + | # edit ndk-16.config.py | ||
| + | # ABI(" | ||
| + | |||
| + | ANDROID_SDK=${BASE} ANDROID_HOME=${BASE} ./ | ||
| + | --force_opencv_toolchain \ | ||
| + | --ndk_path ${REAL_ANDROID_SDK}/ | ||
| + | --config ndk-16.config.py \ | ||
| + | ${BASE}/ | ||
| + | </ | ||
| + | |||
| + | To compile against libc++, I then changed ANDROID_STL=" | ||
| + | |||
| + | @ngriffiths you need to strip out intel threading libs (TBB). That' | ||
| + | |||