Attendance Made Easy

Abhiroop Bas
1 min readFeb 7, 2021
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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Abhiroop Bas
Abhiroop Bas

No responses yet

Write a response