Skip to main content

Posts

Showing posts from June, 2020

How Far You Are From Your Camera? Python | OpenCv

Hello Friends! In this blog, you will learn to find out the distance between you and your webcam. Take a look at the video below.  Let's get started. For this project, we will be using face detection using the Haar Cascade method. Therefore, we need to download the cascade classifier for face detection from Github. You can download and paste the file from this link . Let us first understand what is Haar Cascade?  Haar Cascade  is a machine learning object detection algorithm used to identify objects in an image or video and based on various​​ features.  If you want to read a more detailed version of it, check out this link . Now, we will start by importing the libraries and define a variable to capture video from my webcam. import cv2 import numpy as np cap = cv2.VideoCapture( 0 ) Let us import our classifier file which we downloaded from Github. face = cv2.CascadeClassifier( 'haarcascade_frontalface_alt.xml' ) write a while loop and capture the image frames. Also, we need