My Blogs

Welcome to my new Technical blogs

A simple face detection program using python (opencv)

By using simple opencv we can make a python program that can detect faces easily from the realtime video that is captured via the webcam. The code is given below.

'''Basic face detector from video Program'''

import cv2

FACE_CASCADE = cv2.CascadeClassifier('./sample/xml/face_detection_basic.xml')
VIDEO_CAPTURE = cv2.VideoCapture(0)


while True:
    _, IMG = VIDEO_CAPTURE.read()
    FACES = FACE_CASCADE.detectMultiScale(IMG, scaleFactor=1.05, minNeighbors=4)
    for x, y, w, h in FACES:
        IMG = cv2.rectangle(IMG, (x, y), (x+w, y+h), (0, 255, 0), 4)
        FLIP_IMAGE = cv2.flip(IMG, 1)
        cv2.imshow('Face', FLIP_IMAGE)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
VIDEO_CAPTURE.release()
cv2.destroyAllWindows()

Here we have used the standerd cascade classifier that is available in the github repo of opencv , this cascade classifier xml file is the key element for the detection of faces in the realtime video.

by Ayan Biswas March 16, 2020


What is computer vision in some easy word

Computer vision is an interdisciplinary scientific field that deals with how computers can gain high-level understanding from digital images or videos. From the perspective of engineering, it seeks to understand and automate tasks that the human visual system can do.

We use various tools that have been developed by some extraordinary computer enthusiasts for this purpose like opencv this is a library available for python by which we can process videos and images .

by Ayan Biswas March 15, 2020


Follow My Blog

Get new content delivered directly to your inbox.

Create your website at WordPress.com
Get started