Computer Vision with OpenCV 3 and Qt5

Book description

Blend the power of Qt with OpenCV to build cross-platform computer vision applications

About This Book

  • Start creating robust applications with the power of OpenCV and Qt combined
  • Learn from scratch how to develop cross-platform computer vision applications
  • Accentuate your OpenCV applications by developing them with Qt

Who This Book Is For

This book is for readers interested in building computer vision applications. Intermediate knowledge of C++ programming is expected. Even though no knowledge of Qt5 and OpenCV 3 is assumed, if you're familiar with these frameworks, you'll benefit.

What You Will Learn

  • Get an introduction to Qt IDE and SDK
  • Be introduced to OpenCV and see how to communicate between OpenCV and Qt
  • Understand how to create UI using Qt Widgets
  • Know to develop cross-platform applications using OpenCV 3 and Qt 5
  • Explore the multithreaded application development features of Qt5
  • Improve OpenCV 3 application development using Qt5
  • Build, test, and deploy Qt and OpenCV apps, either dynamically or statically
  • See Computer Vision technologies such as filtering and transformation of images, detecting and matching objects, template matching, object tracking, video and motion analysis, and much more
  • Be introduced to QML and Qt Quick for iOS and Android application development

In Detail

Developers have been using OpenCV library to develop computer vision applications for a long time. However, they now need a more effective tool to get the job done and in a much better and modern way. Qt is one of the major frameworks available for this task at the moment.

This book will teach you to develop applications with the combination of OpenCV 3 and Qt5. This book will teach you to create cross-platform computer vision applications. We'll begin by introducing Qt, its IDE, and its SDK. Next you'll learn how to use the OpenCV API to integrate both tools, and see how to configure Qt to use OpenCV. You'll go on to build a full-fledged computer vision application throughout the book.

Later, you'll create a stunning UI application using the Qt widgets technology, where you'll display the images after they are processed in an efficient way. At the end of the book, you'll learn how to convert OpenCV Mat to Qt QImage. You'll also see how to efficiently process images to filter them, transform them, detect or track objects as well as analyze video. You'll become better at developing OpenCV applications.

Style and approach

This book will help you understand and create cross-platform and multithreaded computer vision applications with the help of OpenCV 3 and Qt5, using a plugin-based and modular application development approach.

Table of contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  2. Introduction to OpenCV and Qt
    1. What is required?
    2. Introduction to Qt
      1. Qt Essentials
      2. Qt Add-Ons
      3. Value-Add Modules
      4. Technology Preview Modules
      5. Platforms supported by Qt
      6. Qt Creator
    3. Introduction to OpenCV
      1. Main modules
      2. Extra modules
    4. Installing Qt
      1. Preparing for Qt installation
      2. Where to get it?
      3. How to install?
        1. Windows users
        2. macOS users
        3. Linux users
      4. Testing Qt installation
    5. Installing OpenCV
      1. Preparing for an OpenCV build
      2. Where to get OpenCV?
      3. How to build?
      4. Configuring OpenCV installation
      5. Testing OpenCV installation
    6. Summary
  3. Creating Our First Qt and OpenCV Project
    1. What is Qt Creator?
    2. A tour of the IDE
      1. Qt Creator modes
        1. The Welcome mode
          1. Projects
          2. Examples
          3. Tutorials
        2. Edit mode
        3. Design mode
          1. Designing user interfaces
          2. Hello Qt and OpenCV
          3. Writing the code for a Qt project
        4. Help mode
      2. The Qt Creator Options window
    3. Summary
  4. Creating a Comprehensive Qt+OpenCV Project
    1. Behind the scenes
      1. The qmake tool
      2. Meta-Object Compiler (moc)
      3. User Interface Compiler (uic)
    2. Design patterns
    3. Qt Resource System
    4. Styling applications
      1. Selector types
      2. Sub-controls
      3. Pseudo-states
      4. Cascading
    5. Multi-language support
    6. Creating and using plugins
      1. The interface
      2. The plugin
      3. The plugin loader and user
    7. Creating the foundations
    8. Summary
  5. Mat and QImage
    1. All about the Mat class
      1. Constructors, properties, and methods
      2. The Mat_<_Tp> class
      3. Matx< _Tp, m, n >
      4. The UMat class
      5. InputArray, OutputArry, InputOutputArray
    2. Reading images using OpenCV
    3. Writing images using OpenCV
    4. Reading and writing videos in OpenCV
    5. The HighGUI module in OpenCV
    6. Image and video handling in Qt
      1. The QImage class
      2. The QPixmap class
      3. The QImageReader and QImageWriter classes
      4. The QPainter class
      5. Camera and video handling in Qt
    7. Summary
  6. The Graphics View Framework
    1. The Scene-View-Item architecture
    2. The Scene, QGraphicsScene
    3. The Items, QGraphicsItem
    4. The View, QGraphicsView
    5. Summary
  7. Image Processing in OpenCV
    1. Image filtering
      1. Filtering functions in OpenCV
    2. Image transformation capabilities
      1. Geometric transformations
      2. Miscellaneous transformations
        1. Colors and color spaces
        2. Image thresholding
        3. Discrete Fourier transform
    3. Drawing in OpenCV
    4. Template matching
    5. Summary
  8. Features and Descriptors
    1. Base of all algorithms – the Algorithm class
    2. The 2D Features Framework
      1. Detecting features
        1. KAZE and AKAZE
        2. The BRISK class
        3. FAST
        4. GFTT (Good Features to Track)
        5. ORB
      2. Extracting and matching descriptors
    3. How to choose an algorithm
      1. Accuracy
      2. Speed
      3. Resource usage
      4. Availability
    4. Summary
  9. Multithreading
    1. Multithreading in Qt
    2. Low-level multithreading using QThread
      1. Subclassing QThread
      2. Using the moveToThread function
    3. Thread synchronization tools
      1. Mutexes
      2. Read-write locks
      3. Semaphores
      4. Wait conditions
    4. High-level multithreading using QtConcurrent
    5. Summary
  10. Video Analysis
    1. Understanding histograms
    2. Understanding back-projection images
      1. Histogram comparison
      2. Histogram equalization
    3. MeanShift and CamShift
    4. Background/foreground detection
    5. Summary
  11. Debugging and Testing
    1. Debugging with Qt Creator
      1. Getting started with the debugging mode
    2. Qt Test Framework
      1. Creating a Unit Test
      2. Data-driven testing
      3. Benchmarking
      4. GUI testing
      5. testcase projects
    3. Summary
  12. Linking and Deployment
    1. The build process, behind the scenes
      1. Preprocessing
      2. Compiling
      3. Linking
    2. Building OpenCV static libraries
    3. Building Qt static libraries
    4. Deploying Qt+OpenCV applications
      1. Deploying using static linking
      2. Deploying using dynamic linking
      3. Qt Installer Framework
    5. Summary
  13. Qt Quick Applications
    1. Introduction to QML
    2. User interaction and scripting in QML
    3. Using Qt Quick Designer
    4. Structure of a Qt Quick Application
    5. Integrating C++ and QML codes
    6. Qt and OpenCV apps on Android and iOS
    7. Summary
  14. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Computer Vision with OpenCV 3 and Qt5
  • Author(s): Amin Ahmadi Tazehkandi
  • Release date: January 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788472395