- 268 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
OpenCV 3.x with Python By Example
About This Book
Learn the techniques for object recognition, 3D reconstruction, stereo imaging, and other computer vision applications using examples on different functions of OpenCV.
Key Features
- Learn how to apply complex visual effects to images with OpenCV 3.x and Python
- Extract features from an image and use them to develop advanced applications
- Build algorithms to help you understand image content and perform visual searches
- Get to grips with advanced techniques in OpenCV such as machine learning, artificial neural network, 3D reconstruction, and augmented reality
Book Description
Computer vision is found everywhere in modern technology. OpenCV for Python enables us to run computer vision algorithms in real time. With the advent of powerful machines, we have more processing power to work with. Using this technology, we can seamlessly integrate our computer vision applications into the cloud. Focusing on OpenCV 3.x and Python 3.6, this book will walk you through all the building blocks needed to build amazing computer vision applications with ease.
We start off by manipulating images using simple filtering and geometric transformations. We then discuss affine and projective transformations and see how we can use them to apply cool advanced manipulations to your photos like resizing them while keeping the content intact or smoothly removing undesired elements. We will then cover techniques of object tracking, body part recognition, and object recognition using advanced techniques of machine learning such as artificial neural network. 3D reconstruction and augmented reality techniques are also included. The book covers popular OpenCV libraries with the help of examples.
This book is a practical tutorial that covers various examples at different levels, teaching you about the different functions of OpenCV and their actual implementation. By the end of this book, you will have acquired the skills to use OpenCV and Python to develop real-world computer vision applications.
What you will learn
- Detect shapes and edges from images and videos
- How to apply filters on images and videos
- Use different techniques to manipulate and improve images
- Extract and manipulate particular parts of images and videos
- Track objects or colors from videos
- Recognize specific object or faces from images and videos
- How to create Augmented Reality applications
- Apply artificial neural networks and machine learning to improve object recognition
Who this book is for
This book is intended for Python developers who are new to OpenCV and want to develop computer vision applications with OpenCV and Python. This book is also useful for generic software developers who want to deploy computer vision applications on the cloud. It would be helpful to have some familiarity with basic mathematical concepts such as vectors, matrices, and so on.
Frequently asked questions
Information
Applying Geometric Transformations to Images
- How to install OpenCV-Python
- How to read, display, and save images
- How to convert to multiple color spaces
- How to apply geometric transformations such as translation, rotation,
and scaling - How to use affine and projective transformations to apply funny geometric effects to photos
Installing OpenCV-Python
Windows
- Install Python: Make sure you have Python 2.7.x installed on your machine. If you don't have it, you can install it from: https://www.python.org/downloads/windows/.
- Install NumPy: NumPy is a great package to do numerical computing in Python. It is very powerful and has a wide variety of functions. OpenCV-Python plays nicely with NumPy, and we will be using this package a lot during the course of this book. You can install the latest version from: http://sourceforge.net/projects/numpy/files/NumPy/.
>>> import numpy
- Navigate to opencv/build/python/2.7/.
- You will see a file named cv2.pyd. Copy this file to C:/Python27/lib/site-packages.
>>> import cv2
macOS X
$ ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install python
$ which python
$ brew tap homebrew/science
$ pip install numpy
$ brew install opencv --with-tbb --with-opengl
$ cd /Library/Python/2.7/site-packages/
$ ln -s /usr/local/Cellar/opencv/3.1.0/lib/python2.7/site-packages/cv.py
cv.py
$ ln -s /usr/local/Cellar/opencv/3.1.0/lib/python2.7/site-packages/cv2.so
cv2.so
> import cv2
Linux (for Ubuntu)
[compiler] $ sudo apt-get install build-essential
[required] $ sudo apt-get install cmake git libgtk2.0-dev pkg-config
libavcodec-dev libavformat-dev libswscale-dev git
libgstreamer0.10-dev libv4l-dev
[optional] $ sudo apt-get install python-dev python-numpy libtbb2
libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev
libdc1394-22-dev
$ mkdir ~/opencv
$ git clone -b 3.3.0 https://github.com/opencv/opencv.git opencv
$ cd opencv
$ git clone https://github.com/opencv/opencv_contrib.git opencv_contrib
$ mkdir release
$ cd release
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib/modules -D BUILD_PYTHON_SUPPORT=ON -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D WITH_EIGEN=ON -D BUILD_EXAMPLES=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4...
Table of contents
- Title Page
- Copyright and Credits
- Contributors
- Packt Upsell
- Preface
- Applying Geometric Transformations to Images
- Detecting Edges and Applying Image Filters
- Cartoonizing an Image
- Detecting and Tracking Different Body Parts
- Extracting Features from an Image
- Seam Carving
- Detecting Shapes and Segmenting an Image
- Object Tracking
- Object Recognition
- Augmented Reality
- Machine Learning by an Artificial Neural Network
- Other Books You May Enjoy