1 / 12

Embedded Programming and Robotics

Embedded Programming and Robotics. Lesson 17 The OpenCV (Computer Vision) Library. Install Required Software. Some of the things in this next are probably already installed, but run this just to be safe sudo apt-get install build-essential cmake pkg-config Install image I/O packages

jjohn
Download Presentation

Embedded Programming and Robotics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Embedded Programming and Robotics Lesson 17 The OpenCV (Computer Vision) Library The OpenCV Library

  2. Install Required Software • Some of the things in this next are probably already installed, but run this just to be safe sudoapt-get install build-essential cmakepkg-config • Install image I/O packages sudoapt-get install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev • Install the GTK development library sudoapt-get install libgtk2.0-dev The OpenCV Library

  3. Install Required Software • Install video I/O packages sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev • Install openCV optimization libraries: sudo apt-get install libatlas-base-dev gfortran • Install pip wget https://bootstrap.pypa.io/get-pip.py sudopython get-pip.py The OpenCV Library

  4. Install Required Software • Install  virtualenv  and virtualenvwrapper sudo pip install virtualenvvirtualenvwrapper • Then, update your ~/.profile  file to include the following lines # virtualenv and virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh • Reload your profile source ~/.profile The OpenCV Library

  5. Install Required Software • Create your computer vision virtual environment: mkvirtualenvcv • Install the Python 2.7 development tools (Python 3 does not yet support openCV 2.4): sudo apt-get install python2.7-dev • Install NumPy since the OpenCV Python bindings represent images as multi-dimensional NumPy arrays: pip install numpy The OpenCV Library

  6. Install Required Software • Download OpenCV and unpack it: 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 The OpenCV Library

  7. Install Required Software • Set up the build: • 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 .. The OpenCV Library

  8. Install Required Software • Compile openCV: make • Finally, install openCV: sudo make install sudoldconfig • OpenCV should now be installed in  /usr/local/lib/python2.7/site-packages The OpenCV Library

  9. Install Required Software • To utilize OpenCV within our cv  virtual environment, we first need to sym-link OpenCV into our site-packages  directory: cd ~/.virtualenvs/cv/lib/python2.7/site-packages/ ln -s /usr/local/lib/python2.7/site-packages/cv2.so cv2.so ln -s /usr/local/lib/python2.7/site-packages/cv.py cv.py The OpenCV Library

  10. Install Required Software • Give your OpenCV and Python installation a test drive: workon cv Python >>> import cv2 >>> cv2.__version__ '2.4.10‘ • This lets you bring up the Python shell, import the library, and call a static method to show the version. If this works, all is well. The OpenCV Library

  11. Install Required Software The OpenCV Library

  12. References • http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/ • http://docs.opencv.org/modules/core/doc/intro.html The OpenCV Library

More Related