Installing OPENCV on the Raspberry Pi

Source: Internet
Author: User

Install the runtime library first

sudo apt-get updatesudo apt-get upgradesudo apt-get install -y  Build-essentialsudo apt-get install -y cmake sudo apt-get install -y  pkg-config sudo apt-get install -y libpng12-0 libpng12-dev libpng++- Dev libpng3 sudo apt-get install -y libpnglite-devsudo apt-get install  -y zlib1g-dbg zlib1g zlib1g-dev sudo apt-get install -y pngtools  libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools sudo apt-get install  -y libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-progs sudo apt-get  Install -y ffmpeg libavcodec-dev libavcodec53 libavformat53 libavformat-dev  sudo apt-get install -y libgstreamer0.10-0-dbg libgstreamer0.10-0   libgstreamer0.10-dev sudo apt-get install -y libxine1-ffmpeg  libxine-dev libxine1-bin sudo  Apt-get install -y libunicap2 libunicap2-dev sudo apt-get install -y  libdc1394-22-dev libdc1394-22 libdc1394-utils sudo apt-get install -y  swig sudo apt-get install -y libv4l-0 libv4l-dev sudo apt-get  install -y python-numpy sudo apt-get install -y libpython2.6  Python-dev python2.6-dev sudo apt-get install -y libgtk2.0-dev

Download the source code and compile

wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download Opencv-2.4.9.zipunzip OPENCV-2.4.9.ZIPRM opencv-2.4.9.zipcd opencv-2.4.9mkdir BUILDCD buildcmake-d CMAKE_BUILD_TYPE= release-d cmake_install_prefix=/usr/local-d build_python_support=on-d Build_examples=on. Make

It takes a long time to compile and install

sudo make install/usr/local/lib #没作用似乎

Adding environment variables

sudo nano/etc/bash.bashrc
Pkg_config_path= $PKG _config_path:/usr/local/lib/pkgconfig Export Pkg_config_path #添加到上面的那个文件的末尾中

To finish, start designing happily, here is an example of showing a picture opshow_demo.py:

Import CV2 Import NumPy as NP # read imagesimg = Cv2.imread ("./rubylin.jpg") # show Imagecv2.imshow ("Image", IMG) cv2 . Waitkey (0) cv2.destroyallwindows ()


Installing OPENCV on the Raspberry Pi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.