Book Image

Computer Vision Projects with OpenCV and Python 3

By : Matthew Rever
Book Image

Computer Vision Projects with OpenCV and Python 3

By: Matthew Rever

Overview of this book

Python is the ideal programming language for rapidly prototyping and developing production-grade codes for image processing and Computer Vision with its robust syntax and wealth of powerful libraries. This book will help you design and develop production-grade Computer Vision projects tackling real-world problems. With the help of this book, you will learn how to set up Anaconda and Python for the major OSes with cutting-edge third-party libraries for Computer Vision. You'll learn state-of-the-art techniques for classifying images, finding and identifying human postures, and detecting faces within videos. You will use powerful machine learning tools such as OpenCV, Dlib, and TensorFlow to build exciting projects such as classifying handwritten digits, detecting facial features,and much more. The book also covers some advanced projects, such as reading text from license plates from real-world images using Google’s Tesseract software, and tracking human body poses using DeeperCut within TensorFlow. By the end of this book, you will have the expertise required to build your own Computer Vision projects using Python and its associated libraries.
Table of Contents (9 chapters)

Result analysis

When we run our code using the best candidate code block, we get the following result:

if len(plate_candidates) > 0: 
plate_candidates.sort(key = lambda plate_candidate:
len(plate_candidate.chars), reverse = True)
best_plate = plate_candidates[0]
print("License plate read: " + best_plate.chars + "\n")

License plate read: LTLDBENZ

Once we get our output, we can display our result using the following code:

figure()
imshow(best_plate.thesholded)

The displayed image will be as follows:

Although there is an extra character, we can see that our displayed image is very close to the plate characters. We can, check it with our other possible plate characters to get the closest result.

Let's try one more license plate, to check how our code works:

input_image = plt.imread('tests/p2.jpg') #use cv2.imread...