编译器安装:sudo apt-get install build-essential cmake pkg-config
图片库:sudo apt-get install libjpeg-dev libtiff-dev libjasper-dev libpng-dev
显示GUI用的库:sudo apt-get install libgtk2.0-dev
加载视频的库:sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
优化opencv性能:sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python-dev
pip install numpy
下载opencv源代码:
wget -O opencv-2.4.10.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.10/opencv-2.4.10.zip/download unzip opencv-2.4.10.zip cd opencv-2.4.10 利用cmake编译源代码:mkdir build
cd build cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..make
$ sudo make install
$ sudo ldconfig
时间: 2024-11-12 16:39:17