Fatigue (Drowsiness) Detection using OpenCV (Assignment Sample)
By Reeshal Rittoo (CVBPR S1 27)
BSc Computer Science Year 3
University of Mauritius
CSE 3093Y Computer Vision, Biometrics and Pattern Recognition
March 2021
The system uses a webcam in order to analyse the user’s face and then detects whether he is drowsy. It monitors two facial features, the eyes and the mouth of the user. Then the system emits a text to wake up the latter.
Main steps in the program
1. Initialise all thresholds needed.
2. Load the haarcascade_frontal face file in the cascade classifier of opencv. It contains lots of images of faces.
3. Load a face landmarks file in the shape predictor of dlib. It allows us to localise specific parts of the face.
4. Open the webcam and read each frame.
5. Resize each frame.
6. Convert each frame to grayscale as it is less complex and easier to work with grayscale images than color images.
7. Apply a detectMultiScale function to identify the rectangles containing faces.
8. In each rectangle, we calculate the eye aspect ratio of both eyes using the landmark file.
9. We also calculate the distance between the top and bottom lip on the face in order to detect yawns.
10. We then draw the contours of the eyes and mouth on each frame.
11. If the eye aspect ratio of a frame is lower than the threshold for a drowsy eye aspect ratio, we increase a count and check the same for the next frames.
12.If the next consecutive frames have an aspect ratio lower than the threshold, it means the user is drowsy and an alarm is triggered, telling the user to wake up.
13.Similarly, if the distance between the top and bottom lip is greater than the threshold for yawns, the user is alerted through a voice audio again.
14.The two alarms and the thresholds are also displayed on each frame.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Fatigue (Drowsiness) Detection using OpenCV (Assignment Sample)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.