OpenCV By Example

Book description

Enhance your understanding of Computer Vision and image processing by developing real-world projects in OpenCV 3

About This Book

  • Get to grips with the basics of Computer Vision and image processing
  • This is a step-by-step guide to developing several real-world Computer Vision projects using OpenCV 3
  • This book takes a special focus on working with Tesseract OCR, a free, open-source library to recognize text in images

Who This Book Is For

If you are a software developer with a basic understanding of Computer Vision and image processing and want to develop interesting Computer Vision applications with Open CV, this is the book for you. Knowledge of C++ is required.

What You Will Learn

  • Install OpenCV 3 on your operating system
  • Create the required CMake scripts to compile the C++ application and manage its dependencies
  • Get to grips with the Computer Vision workflows and understand the basic image matrix format and filters
  • Understand the segmentation and feature extraction techniques
  • Remove backgrounds from a static scene to identify moving objects for video surveillance
  • Track different objects in a live video using various techniques
  • Use the new OpenCV functions for text detection and recognition with Tesseract

In Detail

Open CV is a cross-platform, free-for-use library that is primarily used for real-time Computer Vision and image processing. It is considered to be one of the best open source libraries that helps developers focus on constructing complete projects on image processing, motion detection, and image segmentation.

Whether you are completely new to the concept of Computer Vision or have a basic understanding of it, this book will be your guide to understanding the basic OpenCV concepts and algorithms through amazing real-world examples and projects.

Starting from the installation of OpenCV on your system and understanding the basics of image processing, we swiftly move on to creating optical flow video analysis or text recognition in complex scenes, and will take you through the commonly used Computer Vision techniques to build your own Open CV projects from scratch.

By the end of this book, you will be familiar with the basics of Open CV such as matrix operations, filters, and histograms, as well as more advanced concepts such as segmentation, machine learning, complex video analysis, and text recognition.

Style and approach

This book is a practical guide with lots of tips, and is closely focused on developing Computer vision applications with OpenCV. Beginning with the fundamentals, the complexity increases with each chapter. Sample applications are developed throughout the book that you can execute and use in your own projects.

Table of contents

  1. OpenCV By Example
    1. Table of Contents
    2. OpenCV By Example
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. 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
    8. 1. Getting Started with OpenCV
      1. Understanding the human visual system
      2. How do humans understand image content?
        1. Why is it difficult for machines to understand image content?
      3. What can you do with OpenCV?
        1. In-built data structures and input/output
        2. Image processing operations
        3. Building GUI
        4. Video analysis
        5. 3D reconstruction
        6. Feature extraction
        7. Object detection
        8. Machine learning
        9. Computational photography
        10. Shape analysis
        11. Optical flow algorithms
        12. Face and object recognition
        13. Surface matching
        14. Text detection and recognition
      4. Installing OpenCV
        1. Windows
        2. Mac OS X
        3. Linux
      5. Summary
    9. 2. An Introduction to the Basics of OpenCV
      1. Basic CMake configuration files
      2. Creating a library
      3. Managing dependencies
      4. Making the script more complex
      5. Images and matrices
      6. Reading/writing images
      7. Reading videos and cameras
      8. Other basic object types
        1. The vec object type
        2. The Scalar object type
        3. The Point object type
        4. The Size object type
        5. The Rect object type
        6. RotatedRect object type
      9. Basic matrix operations
      10. Basic data persistence and storage
        1. Writing to a file storage
      11. Summary
    10. 3. Learning the Graphical User Interface and Basic Filtering
      1. Introducing the OpenCV user interface
      2. A basic graphical user interface with OpenCV
      3. The graphical user interface with QT
      4. Adding slider and mouse events to our interfaces
      5. Adding buttons to a user interface
      6. OpenGL support
      7. Summary
    11. 4. Delving into Histograms and Filters
      1. Generating a CMake script file
      2. Creating the Graphical User Interface
      3. Drawing a histogram
      4. Image color equalization
      5. Lomography effect
      6. The cartoonize effect
      7. Summary
    12. 5. Automated Optical Inspection, Object Segmentation, and Detection
      1. Isolating objects in a scene
      2. Creating an application for AOI
      3. Preprocessing the input image
        1. Noise removal
        2. Removing the background using the light pattern for segmentation
        3. The thresholding operation
      4. Segmenting our input image
        1. The connected component algorithm
        2. The findContours algorithm
      5. Summary
    13. 6. Learning Object Classification
      1. Introducing machine learning concepts
      2. Computer Vision and the machine learning workflow
      3. Automatic object inspection classification example
      4. Feature extraction
        1. Training an SVM model
        2. Input image prediction
      5. Summary
    14. 7. Detecting Face Parts and Overlaying Masks
      1. Understanding Haar cascades
      2. What are integral images?
      3. Overlaying a facemask in a live video
        1. What happened in the code?
      4. Get your sunglasses on
        1. Looking inside the code
      5. Tracking your nose, mouth, and ears
      6. Summary
    15. 8. Video Surveillance, Background Modeling, and Morphological Operations
      1. Understanding background subtraction
      2. Naive background subtraction
        1. Does it work well?
      3. Frame differencing
        1. How well does it work?
      4. The Mixture of Gaussians approach
        1. What happened in the code?
      5. Morphological image processing
        1. What's the underlying principle?
      6. Slimming the shapes
      7. Thickening the shapes
      8. Other morphological operators
        1. Morphological opening
        2. Morphological closing
        3. Drawing the boundary
        4. White Top-Hat transform
        5. Black Top-Hat transform
      9. Summary
    16. 9. Learning Object Tracking
      1. Tracking objects of a specific color
      2. Building an interactive object tracker
      3. Detecting points using the Harris corner detector
      4. Shi-Tomasi Corner Detector
      5. Feature-based tracking
        1. The Lucas-Kanade method
        2. The Farneback algorithm
      6. Summary
    17. 10. Developing Segmentation Algorithms for Text Recognition
      1. Introducing optical character recognition
      2. The preprocessing step
        1. Thresholding the image
        2. Text segmentation
          1. Creating connected areas
          2. Identifying paragraph blocks
          3. Text extraction and skew adjustment
      3. Installing Tesseract OCR on your operating system
        1. Installing Tesseract on Windows
          1. Setting up Tesseract in Visual Studio
            1. Setting the import and library paths
            2. Configuring the linker
            3. Adding the libraries to the windows path
        2. Installing Tesseract on Mac
      4. Using Tesseract OCR library
        1. Creating a OCR function
          1. Sending the output to a file
      5. Summary
    18. 11. Text Recognition with Tesseract
      1. How the text API works
        1. The scene detection problem
        2. Extremal regions
        3. Extremal region filtering
      2. Using the text API
        1. Text detection
        2. Text extraction
        3. Text recognition
      3. Summary
    19. Index

Product information

  • Title: OpenCV By Example
  • Author(s): Prateek Joshi, David Millán Escrivá, Vinícius Godoy
  • Release date: January 2016
  • Publisher(s): Packt Publishing
  • ISBN: 9781785280948