Book Image

Mastering OpenCV 3 - Second Edition

By : Jason Saragih
Book Image

Mastering OpenCV 3 - Second Edition

By: Jason Saragih

Overview of this book

As we become more capable of handling data in every kind, we are becoming more reliant on visual input and what we can do with those self-driving cars, face recognition, and even augmented reality applications and games. This is all powered by Computer Vision. This book will put you straight to work in creating powerful and unique computer vision applications. Each chapter is structured around a central project and deep dives into an important aspect of OpenCV such as facial recognition, image target tracking, making augmented reality applications, the 3D visualization framework, and machine learning. You’ll learn how to make AI that can remember and use neural networks to help your applications learn. By the end of the book, you will have created various working prototypes with the projects in the book and will be well versed with the new features of OpenCV3.
Table of Contents (14 chapters)
Title Page
Mastering OpenCV 3 Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Plate recognition


The second step in License Plate Recognition aims to retrieve the characters of the license plate with Optical Character Recognition. For each detected plate, we proceed to segment the plate for each character and use an Artificial Neural Network machine learning algorithm to recognize the character. Also, in this section, you will learn how to evaluate a classification algorithm.

OCR segmentation

First, we will obtain a plate image patch as an input to the OCR segmentation function with an equalized histogram. We then need to apply only a threshold filter and use this threshold image as the input of a Find Contours algorithm. We can observe this process in the following image:

This segmentation process is coded as follows:

      Mat img_threshold; 
      threshold(input, img_threshold, 60, 255, CV_THRESH_BINARY_INV); 
      if(DEBUG) 
      imshow("Threshold plate", img_threshold); 
      Mat img_contours; 
      img_threshold.copyTo(img_contours); 
      //Find contours...