首先,我们需要安装一些必要的包
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
然后,我们去官网下载Opencv2.4.13 for Linux
接着,我们进行编译和安装
unzip opencv-2.4.13.zip
cd opencv-2.4.13/
cmake -D WITH_GTK_2_X=ON -D CMAKE_INSTALL_PREFIX=/usr/local .
make # make -j4表示开4个线程来进行编译
make install
安装完成后,我们查看下OpenCV版本进行测试
>>> import cv2
>>> cv2.__version__
'2.4.13'
出现版本信息,就是大功告成啦~
网友评论