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)

Faces in videos

We're going to see our second example from what we learned in the last section on faces in photos. The still image example was neat, but you might be asking about videos. Okay, let's look at that for our next example:

%pylab inline
%cd /home/test/13293

import dlib
import cv2
import os
import tkinter
from tkinter import filedialog
from IPython import display
root = tkinter.Tk()
root.withdraw()

We change to %pylab inline because having all those widgets can actually cause a problem with Jupyter when you want to display a video sequence. We'll need the same code to get started with as shown in the previous example, and only replace notebook with inline. Then, we run the same code again.

After its execution, we move on with the next part. This is actually very close to the same thing because all you have to do is iterate over each frame, and it will work just...