Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Qt 5 and OpenCV 4 Computer Vision Projects

You're reading from  Qt 5 and OpenCV 4 Computer Vision Projects

Product type Book
Published in Jun 2019
Publisher Packt
ISBN-13 9781789532586
Pages 348 pages
Edition 1st Edition
Languages
Author (1):
Zhuo Qingliang Zhuo Qingliang
Profile icon Zhuo Qingliang

Table of Contents (11) Chapters

Preface Building an Image Viewer Editing Images Like a Pro Home Security Applications Fun with Faces Optical Character Recognition Object Detection in Real Time Real-Time Car Detection and Distance Measurement Using OpenGL for the High-Speed Filtering of Images Assessments Other Books You May Enjoy

Preface

We are entering the age of intelligence. Today, more and more digital devices and applications deliver features facilitated by artificial intelligence technology. Computer vision technology is an important part of artificial intelligence technology, while the OpenCV library is one of the most comprehensive and mature libraries for computer vision technology. OpenCV goes beyond traditional computer vision technology; it incorporates many other technologies, such as DNN, CUDA, OpenGL, and OpenCL, and is evolving into a more powerful library. But, at the same time, its GUI facility, which is not the main feature of the library, isn't evolving very much. Meanwhile, among the many GUI development libraries and frameworks, there is one that is the best at crossing platforms, has the best ease of use, and has the greatest widget diversity—the Qt library. The goal of this book is to combine OpenCV and Qt to develop fully-fledged applications providing many interesting features.

This book is a practical guide to the OpenCV library and GUI application development with Qt. We'll develop a complete application in each chapter. In each of those applications, a number of computer vision algorithms, Qt widgets, and other facilities will be covered, and a well-designed user interface with functional features will be created.

This book is the result of months of hard work, and it would not have been possible without the invaluable help of the Packt team and the technical reviewer.

Who this book is for

This book is designed for all those developers who want to know how to use the OpenCV library to process images and videos, for those who want to learn GUI development with Qt, for those who want to know how to use deep learning in the computer vision domain, and for those who are interested in developing fully-fledged computer vision applications.

What this book covers

Chapter 1, Building an Image Viewer, covers building our first application with Qt. We will build an image viewer, with which we can browse images in a folder. We'll also be able to zoom in or out of the image while viewing it.

Chapter 2, Editing Images Like a Pro, combines the Qt library and the OpenCV library to build a new application, an image editor. In this chapter, we will start by blurring an image to learn how to edit an image. Then, we will learn how to use many other editing effects, such as eroding, sharpening, cartoon effects, and geometric transformation. Each of these features will be incorporated as a Qt plugin, so the plugin mechanism of the Qt library will also be covered.

Chapter 3, Home Security Applications, covers building an application for home security. With a webcam, this application can detect motion and send notifications to a mobile phone upon motion being detected. We will learn how to deal with cameras and videos, how to analyze motion and detect movement with OpenCV, and how to send notifications via IFTTT in this chapter.

Chapter 4, Fun with Faces, explores how to detect faces and facial landmarks with OpenCV. We will build an application to detect faces and facial landmarks in the video in real time in this chapter, and, with the facial landmarks detected, we will apply some funny masks to the faces.

Chapter 5, Optical Character Recognition, introduces the Tesseract library to you. With the help of this library, we will extract text from images such as photos of book pages and scanned documents. In order to extract text from photos of common scenes, we will use a deep learning model named EAST to detect the text areas in photos, and then pass those areas to the Tesseract library. In order to extract text on the screen conveniently, we will also learn how to grab the screen as an image with the Qt library.

Chapter 6, Object Detection in Real Time, shows how to use cascade classifiers to detect objects. Besides using pretrained classifiers, we will also learn how to train classifiers by ourselves. Then, we will introduce how to detect objects by using deep learning models, and a model named YOLOv3 will be used to demonstrate the usage of this approach.

Chapter 7, Real-Time Car Detection and Distance Measurement, covers creating an application to detect cars and measure distances. In the application, we will learn how to measure distances between objects from a bird's eye view and how to measure distances between objects and the camera at eye level view.

Chapter 8, Using OpenGL for High-Speed Filtering of Images, the final chapter of the book, introduces an approach to heterogeneous computing. In this chapter, we first have a brief introduction to the OpenGL specification, and then use it to filter images on the GPU. This is not a typical way to use OpenGL, and it is not typical to do heterogeneous computing either, so we can refer to OpenCL or CUDA if we want to do heterogeneous computing in a mature way.

Appendix A, Assessments, contains answers to all the assessment questions.

To get the most out of this book

In order to achieve the overall outcome of this book, the following are the prerequisites:

  • You need to have some basic knowledge of C++ and C programming languages.
  • You need to have Qt v5.0 or above installed.
  • You need to have a webcam attached to your computer.
  • Many libraries, such as OpenCV and Tesseract, are also required. The instructions to install them are included in the chapter in which each library is first used.
  • A knowledge of deep learning and heterogeneous computing will be an advantage in helping to understand some chapters.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Qt-5-and-OpenCV-4-Computer-Vision-Projects. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Code in Action

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, class or type names. Here is an example: "The Qt project file, ImageViewer.pro, should be renamed ImageEditor.pro. You can do this in your file manager or in a Terminal."

A block of code is set as follows:

         QMenu *editMenu;
QToolBar *editToolBar;
QAction *blurAction;

When we wish to draw your attention to a particular part of a code block, a comment will be appended to end of the lines:

         // for editting
void blurImage();

Any command-line input or output is written as follows:

    $ mkdir Chapter-02
$ cp -r Chapter-01/ImageViewer/ Chapter-02/ImageEditor
$ ls Chapter-02
ImageEditor
$ cd Chapter-02/ImageEditor
$ make clean
$ rm -f ImageViewer

The $ symbol is the shell prompt, and the text after it is a command. The lines that don't start with a $ are the output of the preceding command.

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

lock icon The rest of the chapter is locked
Next Chapter arrow right
You have been reading a chapter from
Qt 5 and OpenCV 4 Computer Vision Projects
Published in: Jun 2019 Publisher: Packt ISBN-13: 9781789532586
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}