在Ubuntu中设置OpenCV 2.3 w/python绑定,需要按照以下步骤进行操作:
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff4-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
cd ~
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 2.3
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D PYTHON_INCLUDE_DIR=/usr/include/python2.7 -D PYTHON_LIBRARY=/usr/lib/python2.7/config/libpython2.7.so -D PYTHON_PACKAGES_PATH=/usr/lib/python2.7/dist-packages -D BUILD_PYTHON_SUPPORT=ON ..
make
sudo make install
cd ~/opencv/release/lib/python2.7/site-packages
sudo cp * /usr/lib/python2.7/dist-packages
python -c "import cv2; print cv2.__version__"
如果输出OpenCV的版本号,则说明安装成功。
推荐的腾讯云相关产品和产品介绍链接地址:
领取专属 10元无门槛券
手把手带您无忧上云