RK3399 编译安装opencv3.4(python3.5)

1.安装所需库等等

sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python3.5-dev python3.5-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

2.下载opecv源码并切换分支到3.4.0

git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout 3.4.0

  

git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib/
git checkout 3.4.0

3.build

cd opencv/
mkdir build
cd build/

export PY_NAME=$(python3.5 -c 'from sys import version_info as v; print("python%d.%d" % v[:2])')
export PY_NUMPY_DIR=$(python3.5 -c 'import os.path, numpy.core; print(os.path.dirname(numpy.core.__file__))')

cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
\
-DPYTHON_DEFAULT_EXECUTABLE=$(which python3.5) \
-DPYTHON3_EXECUTABLE=$(which python3.5) \
-DPYTHON3_INCLUDE_DIR=/usr/include/$PY_NAME \
-DPYTHON3_INCLUDE_DIR2=/usr/include/aarch64-linux-gnu/$PY_NAME \
-DPYTHON3_LIBRARY=/usr/lib/aarch64-linux-gnu/lib$PY_NAME.so \
-DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/$PY_NAME/dist-packages/numpy/core/include/ \
\
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
\
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
..
 
 
build完成的结果
 

4.make&install

make -j$(nproc)
sudo make install

  

l

5.想咋用就咋用

posted @ 2019-06-25 10:18  chengjue  阅读(1792)  评论(0编辑  收藏  举报