O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computer Vision with Python 3

Book Description

Unleash the power of computer vision with Python to carry out image processing and computer vision techniques

About This Book

  • Learn how to build a full-fledged image processing application using free tools and libraries
  • Perform basic to advanced image and video stream processing with OpenCV’s Python APIs
  • Understand and optimize various features of OpenCV with the help of easy-to-grasp examples

Who This Book Is For

This book is for Python developers who want to perform image processing. It’s ideal for those who want to explore the field of computer vision, and design and develop computer vision applications using Python. The reader is expected to have basic knowledge of Python.

What You Will Learn

  • Working with open source libraries such Pillow, Scikit-image, and OpenCV
  • Writing programs such as edge detection, color processing, image feature extraction, and more
  • Implementing feature detection algorithms like LBP and ORB
  • Tracking objects using an external camera or a video file
  • Optical Character Recognition using Machine Learning.
  • Understanding Convolutional Neural Networks to learn patterns in images
  • Leveraging Cloud Infrastructure to provide Computer Vision as a Service

In Detail

This book is a thorough guide for developers who want to get started with building computer vision applications using Python 3. The book is divided into five sections: The Fundamentals of Image Processing, Applied Computer Vision, Making Applications Smarter,Extending your Capabilities using OpenCV, and Getting Hands on. Throughout this book, three image processing libraries Pillow, Scikit-Image, and OpenCV will be used to implement different computer vision algorithms.

The book aims to equip readers to build Computer Vision applications that are capable of working in real-world scenarios effectively. Some of the applications that we will look at in the book are Optical Character Recognition, Object Tracking and building a Computer Vision as a Service platform that works over the internet.

Style and approach

Each stage of the book elaborates on various concepts and algorithms in image processing/computer vision using Python. This step-by-step guide can be used both as a tutorial and as a reference.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Introduction to Image Processing
    1. Image processing - its applications
    2. Image processing libraries
      1. Pillow
        1. Installation
        2. Getting started with pillow
          1. Reading an image
          2. Writing or saving an image
          3. Cropping an image
          4. Changing between color spaces
          5. Geometrical transformation
          6. Image enhancement
      2. Introduction to scikit-image
        1. Installation
        2. Getting started with scikit-image
    3. Summary
  3. Filters and Features
    1. Image derivatives
      1. Kernels
    2. Convolution
    3. Understanding image filters
      1. Gaussian blur
      2. Median filter
      3. Dilation and erosion
        1. Erosion
        2. Dilation
      4. Custom filters
      5. Image thresholding
    4. Edge detection
      1. Sobel edge detector
        1. Why have pixels with large gradient values?
      2. Canny edge detector
      3. Hough line
      4. Hough circle
    5. Summary
  4. Drilling Deeper into Features - Object Detection
    1. Revisiting image features
    2. Harris corner detection
    3. Local Binary Patterns
    4. Oriented FAST and Rotated BRIEF (ORB)
      1. oFAST – FAST keypoint orientation
      2. FAST detector
      3. Orientation by intensity centroid
      4. rBRIEF – Rotation-aware BRIEF
      5. Steered BRIEF
      6. Variance and correlation
    5. Image stitching
    6. Summary
  5. Segmentation - Understanding Images Better
    1. Introduction to segmentation
    2. Contour detection
    3. The Watershed algorithm
    4. Superpixels
    5. Normalized graph cut
    6. Summary
  6. Integrating Machine Learning with Computer Vision
    1. Introduction to machine learning
      1. Data preprocessing
        1. Image translation through random cropping
        2. Image rotation and scaling
      2. Scikit-learn  (sklearn)
    2. Applications of machine learning for computer vision
    3. Logistic regression
    4. Support vector machines
    5. K-means clustering
    6. Summary
  7. Image Classification Using Neural Networks
    1. Introduction to neural networks
      1. Design of a basic neural network
      2. Training a network
      3. MNIST digit classification using neural networks
      4. Playing with hidden layers
    2. Convolutional neural networks
    3. Challenges in machine learning
    4. Summary
  8. Introduction to Computer Vision using OpenCV
    1. Installation
      1. macOS
      2. Windows
      3. Linux
    2. OpenCV APIs
      1. Reading an image
        1. Writing/saving the image
        2. Changing the color space
        3. Scaling
        4. Cropping the image
        5. Translation
        6. Rotation
        7. Thresholding
        8. Filters
          1. Gaussian blur
          2. Median blur
        9. Morphological operations
          1. Erosion
          2. Dilation
        10. Edge detection
          1. Sobel edge detection
          2. Canny edge detector
        11. Contour detection
        12. Template matching
    3. Summary
  9. Object Detection Using OpenCV
    1. Haar Cascades
      1. Integral images
    2. Scale Invariant Feature Transformation (SIFT)
      1. Algorithm behind SIFT
        1. Scale-space extrema detection
        2. Keypoint localization
        3. Orientation assignment
        4. Keypoint descriptor
    3. Speeded up robust features
      1. Detecting SURF keypoints
      2. SURF keypoint descriptors
        1. Orientation assignment
        2. Descriptor based on Haar wavelet response
    4. Summary
  10. Video Processing Using OpenCV
    1. Reading/writing videos
      1. Reading a video
      2. Writing a video
    2. Basic operations on videos
      1. Converting to grayscale
    3. Color tracking
    4. Object tracking
      1. Kernelized Correlation Filter (KCF)
      2. Lucas Kanade Tracker (LK Tracker)
    5. Summary
  11. Computer Vision as a Service
    1. Computer vision as a service – architecture overview
    2. Environment setup
      1. http-server
      2. virtualenv
      3. flask
    3. Developing a server-client model
      1. Client
      2. Server
    4. Computer vision engine
    5. Putting it all together
      1. Client
      2. Server
    6. Summary