Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Embedded Programming and Robotics Lesson 17 The OpenCV (Computer Vision) Library The OpenCV Library1."— Presentation transcript:

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

2 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 sudo apt-get install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev Install the GTK development library sudo apt-get install libgtk2.0-dev The OpenCV Library2

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 sudo python get-pip.py The OpenCV Library3

4 Install Required Software Install virtualenv and virtualenvwrapper sudo pip install virtualenv virtualenvwrapper 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 Library4

5 Install Required Software Create your computer vision virtual environment: mkvirtualenv cv 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 Library5

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 Library6

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 Library7

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

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 Library9

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 Library10

11 Install Required Software The OpenCV Library11

12 References http://www.pyimagesearch.com/2015/02/23/install-opencv-and- python-on-your-raspberry-pi-2-and-b/ 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 Library12


Download ppt "Embedded Programming and Robotics Lesson 17 The OpenCV (Computer Vision) Library The OpenCV Library1."

Similar presentations


Ads by Google