Skip to Content
Neural Network Projects with Python
book

Neural Network Projects with Python

by James Loy
February 2019
Beginner to intermediate
308 pages
7h 42m
English
Packt Publishing
Content preview from Neural Network Projects with Python

The onboarding process

Let's write the code for the onboarding process. During the onboarding process, we need to activate the webcam to capture a true image of the authorized user. OpenCV has a function called VideoCapture that allows us to activate and capture the image from the computer's webcam:

import cv2video_capture = cv2.VideoCapture(0)

Let's give the user five seconds to prepare before taking a photo using the webcam. We start a counter variable with an initial value of 5 and snap a photo using the webcam once the counter reaches 0. Note that we use the code in the face_detection.py file that we have written earlier in the chapter to detect faces in front of the webcam. The photo will be saved as 'true_img.png' in the same folder ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning with Python Cookbook

Machine Learning with Python Cookbook

Chris Albon

Publisher Resources

ISBN: 9781789138900Supplemental Content