Attendance Made Easy

Python | Opencv | Haarcascades

The problem

I realized one of the major problems in the online era was faced by the teachers. Online classes are just the tip of the iceberg. As I would personally supply teachers with the screenshots as attendance, I realized the effort the teacher needed to give into maintaining a proper register for the same on a daily basis.

The solution

Hence as I was learning opencv and the haarcascade library, I really wanted to do something for my teachers. The following code enables one to get the number of attendees in a big meeting for example. This will be particularly useful while compiling the attendance for an entire semester.

The code

import cv2
import sys

print(“Enter the path of the image”)
imagePath = input()
cascPath = “haarcascade_frontalface_default.xml”

faceCascade = cv2.CascadeClassifier(cascPath)

image = cv2.imread(imagePath)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.1,
minNeighbors=5,
minSize=(1,1),
flags = cv2.CASCADE_SCALE_IMAGE
)

print(“{0} faces detectd!”.format(len(faces)))

for (x, y, w, h) in faces:
cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)

cv2.imshow(“Faces Detected”, image)
cv2.waitKey(0)

Please feel free to send in suggestions or collaborations on the project.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

7 Goals for learning python and to get a job in 7 weeks

Multithreading in Operating System:

Kotlin Vs Java : Basic Syntax Differences

An obvious use for .Lerp() that does NOT involve animation

Google Earth App Mac Air

Creative Writing Using Quotes In A Paper

Free SSL certificate for your Kubernetes cluster with Rancher

AuroraFS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhiroop Bas

Abhiroop Bas

More from Medium

Want to start medical image analysis?

Unable to run bag of features

Understanding Artificial Intelligence For Game Development

Let Laser Illustrate the Background of your Eye