You are on page 1of 6

Eyes blink detection using Haar Cascade

Subtitle as needed (paper subtitle)

Nguyen Duy Quang Nguyen Dinh Nguyen


Faculty of Electrical & Electronics Engineering Faculty of Electrical & Electronics Engineering
Bach Khoa University Bach Khoa University
Ho Chi Minh City, Vietnam Ho Chi Minh City, Vietnam
nguyenduyquang06@gmail.com nguyen0096@gmail.com
Abstract By checking According to a report of II. METHODOLOGY image and the
eyes is opened or closed, we the General Statistics Office,
can easily detect if a driver is in the first seven months of A. Object detection using rotated integral image
sleeping or count the number 2015, there were 12,910 Haar-like feature based from an original
of blinking eyes. traffic accidents and an cascaded classifier.
Furthermore, it can be used average of 61 accidents per image :
in healthcare to help doctors First, confirm that you
day. And nearly 70% of have the correct template for
cure patients - who has traffic accidents occur your paper size. This
problems with eyes like Dry
between 12 and 24 hours, template has been tailored
Eye - as a tool to measure
parameters related to blink.
according to the Traffic for output on the US-letter
By using Haar Cascade and Police Department. This is paper size. If you are using
image processing, eyes blink the period when the driver of A4-sized paper, please close
detections algorithm not only the vehicle is subjected to the this file and download the
easily implements but also is psychological effects of file MSW_A4_format.
strong enough to use in fatigue. The difference in
practice, specially we only temperature, light between The main idea of object
need a cheap webcam and a day and night (especially for detection is to use available
mid-range laptop or PC to means of passenger classifier which is trained
run. transport, goods ...). Addition before with images of a
to, based on report(1), Dr. particular object(2). The
Keywords Face Telfilo Lee Chiong says that
detection; Eyes detection;
classifier scans whole image
the lack of sleep is one of the to fit a region of pixels at
Haar Cascade; Eyes blink major causes of traffic
detection; warning avoid different sizes. The resultant
accidents in the world. classifier includes multiple
sleeping, Dry Eyes diagnose
Estimate that 10-15% of the
system automatically. simpler classifiers of 3
car accidents are related to
lack of sleep. Specially, in types: (a) edge features, (b)
Vietnam, the driver is usually line features and (c) center- Fig. 2 (a) Upright Summed Area
I. INTRODUCTION work more than 20 hours per surround features as shown Table and (b) Rotated Summed
day. According to AAA in figure below Area Table; calculation scheme of
According to a recent the pixel sum of SAT (c) and
Foundation, the accident rate RSAT(d)
survey, the number of
will be 11,5 times compared
portable devices is increasing
to people sleeping 7 hours or
unbelievable. In 2014, this
more per day. So, people B. Detect face(2) and eye
number get over the number
need a convenient way to with OpenCV Cascade
of people in the world.
avoid accident from lack of Classifier.
Therefore, peoples will
sleep. Eyes blink detection
spend more times with Image preprocessing is
come as a handy way to
computer and portable required in order to make
solve this problem. By using
devices. Consequently, many detection effortless. These
this program, we can alert
diseases are appeared steps are (a) downsampling
the driver in the event of
regularly, specially that are and (b) contrast
eyes closed more than 3
problems with eyes like Dry Fig. 1 Types of rectangular
seconds, we hope that by this enhancement.
Eyes because people tend to features
way, it let the death rate Because the algorithm
reduce blink rate on screen The algorithm applies all
cause the lack of sleep will scan whole image to fit
time. This will make the rate of these simple classifiers to
decrease significantly. Haar features. If the image is
of unconscious eye blinking the region of interest.
while looking at screen Furthermore, we hope too large, it would take more
These simple rectangular
within close distance reduce that this blinking detection time to finish. Therefore, we
features include upright
notably and make eyes tired. system will be available on have to downsampling the
features and tilted features
Our mission aim to create portable devices as a smart image.
are respectively calculated
a blinking detection program feature to help people answer by using integral image and
to measure parameters the question how to have a rotated integral image also
related to blink in real-time. good general healthy body known as Summed Area
By this way, it will make and change the habit using
patients increase or decrease Table (SAT) and Rotated
portable devices.
their blink rate and type of Summed Area Table Fig. 2 Shrinking the image then
(RSAT). These equations calculte the face Rect on the
blink to avoid Dry Eyes original size image
efficiently. and figure below show how
For face and eye detect
to determine the integral
we will have 2 variables:

Identify applicable sponsor/s here. If no sponsors, delete this text box (sponsors).
face_scale and eye_scale. the left half and then again Fig. 4 Algorithm chart
They are ratio between on the right half, we would
detect size and original size see a very distinct edge in
of image. We recorded the the middle because the III. RESULT AND DISCUSSION
minimum eye_scale that average brightness is likely
detect both eye smoothly to be different on the left and A. Specification
with different video the right side, so to remove Base on algorithm above,
resolution at 15cm and 20cm this edge, we will apply the we create an application that
in the table below: two histogram equalizations using eyes blink detection to
gradually from the left-or provide eyes blink counter
right-hand side towards the tool with specification
center and mix it with a below:
whole-face histogram
equalization, so that the far Table 2 Specification in real-time
left-hand side will use the
left histogram equalization, Parameter
the far right-hand side will Distance operation range:
Fig. 5 Open eye detection with high
use the right histogram Optimal operating distance: brightness
equalization, and the center Frame size
will use a smooth mix of left Frame per second average

Table 1 Best minimum eye_scale or right value and the whole- Frame per second maximum
face equalized value. Frame per second minimum
Resolution Distance Original Environment requirement
1920x1080 15cm 531x177 Brightness operation range
20cm 480x160 Optimal operating brightness

1280x720 15cm 345x115 Video Source


20cm 315x105

480x320 15cm 147x49

20cm 135x45
These parameters are
measured using the
Original and detect following environment:
columns are sizes of eye
region before and after Table 3 Environment parameters
shrinking. Original eye
region is calculated from Parameter Fig. 6 Close eye detection with
Fig. 3 Separate histogram
face Rect by determining equalizing CPU high brightness
relatively eye position on Video Graphic Card
face. From the table, we can Ram For 2 figures above, the
This process will remove
see that eye can be easily OS test environment is a full
unbalance lighting on each Brightness
detected if detect region is light room about 200 lux.
side of face. Webcam
about 165x55 pixels. We This is also the ideal
In conclusion, the process is
designed an automatic mode environment for this
demonstrated as the chart in
that define best eye_scale application. The ability of
Figure 4. B. Experiment
according to detected face eyes blink detection is
Rect. We carried out the test
maximized. The average of
Then, we equalize the with several environments
FPS will be about 20 FPS
histogram to differ the bright for our application.
and 18 FPS when dropped.
and dark area(3). Beside
equalizing histogram for
entire image, we process a
separate equalizing by
splitting the image into left
and right halves of the face.
If we simply applied
histogram equalization on
observation, with an FPS
counter (Frame Per Second).
When eyes are tired, eyes
tend to focus on longer than
usual. During the
examination, with this
automated system, it helps to
alert patients to open their
eyes so that the diagnosis
and examination can be
more accurate. Or simply to
warn employees or drivers
not to fall asleep. Thus, to
avoid accidental
occupational accidents or
accidents to others
Fig. 7 Open eye detection with unfortunately. We easily set
medium brightness Fig. 9 Close eye detection with low Fig. 11 Close eye detection with the time it takes to warn of
brightness low brightness this situation.
For figure above, the test
environment is a half light For figure 8 and 9 above, the For figure 10 and 11
room about 100 lux. FPS test environment is no room above, the test environment
will be dropped to about 17 light but laptop screen light is no room light but laptop
FPS. with brightness. As we screen light with Fig. 10 Enable/disable sleep or
calculated, brightness is brightness and sunlight wake alarm
about 40 lux. FPS will be splashing into. FPS is
dropped to about 14 FPS. calculated about 14. Besides, the proverbial
"blink of an eye" lasts only a
For 480p (640x480) tenth of a second, but that is
video, FPS is calculated all the time needed to clear
about 25 and it would be 11 away dust particles and
if video has Full-HD spread lubricating fluids
(1080p) resolution. Video across the eyeball. Every
Full-HD make FPS decrease time you blink, your eyelids
but the ability of detection spread a cocktail of oils and
more accurately mucous secretions across the
IV. ADDITIONAL FEATURES surface of the eye to keep
your globes from drying out.
A. Authors and Affiliations Blinking also keeps eyes
The template is designed safe from potentially
so that author affiliations are damaging stimuli, such as
not repeated each time for bright lights and foreign
Fig. 8 Open eye detection with low
brightness multiple authors of the same bodies like dust. That is why
affiliation. Please keep your we also add alert function
Fig. 10 Open eye detection with affiliations as succinct as when the eye has not been
low brightness possible (for example, do not blinked for too long to avoid
differentiate among eye disease as much as
departments of the same possible.
organization). This template To optimize the
was designed for two performance and
affiliations. functionality of this
application or just serves
As mentioned, the personal purposes, we allow
program supports source to adjusted detect scale
video from real-time camera parameters manually to scale
or video. The external up or scale down the region
interface supports real-time of interest. If there is no
special purpose, we lid closures (> 0.5 second in Object001 21 continuously, the second
recommend using scale eyes duration). tester feels little eyestrain,
1.2 for low resolution this is the result of an eye
webcam (about 640 x 480 Table 7 Operation at some point of
Table 4 Sample of normal eyes time examination using real-time
pixel), using auto-scale for to diagnose in about 1
larger resolution like Full- minute:
HD or HD camera to Parameter Value Time
Measurement parameter
optimize performance. At the All full lid closure (> 0 0.7% (ms)
top-right of this application, second in duration) Contact rate all
FPS (beside the ability to Extended lid closure (> 0.4%
detect) will also be a 0.1 second in duration) Contact rate extended
parameter to evaluate Superextended lid closure 0.2% Contact rate superextended
(> 0 second in duration)
adjustments. 68441 Mean duration all
Mean duration extended
B. Diagnosis of eye Mean duration superextended
condition Table 5 Sample of normal eyes All lid closure blink count
Not only an application Extended lid closure count
that propose eyes blink Parameter Value (second) Superextended lid closure count
counter, but also diagnostic All full lid closure (> 0 0.08
tool for eyes disease, second in duration)
especially dry eye. Extended lid closure (> 0.575
0.1 second in duration)
Time
Measurement parameter
We enable analyze Superextended lid closure 1.589 (ms) Fig. 11 Using parameters real-time
parameters of an eyes (> 0 second in duration) to diagnose
Contact rate all
examination. Based on the
normal eyes samples and Contact rate extended All of personal
scientific studies on the eye, In total we have six information,
Contact rate superextended
date and time,
we analyze parameters of an parameters to measure, measured parameters,
eyes examination. Therefore, corresponding to six 85707 Mean duration all detailed information during
we can give an advice about conditions that need to be the examination and results
eyes condition of the patient. checked. Then we split up Mean duration extendedwill be stored in a datasheet.
We use the mean of lid- into 3 cases that the eye can
contact rate and the mean encountered. That is Non Mean duration superextended
duration of lid closure/blink Dry Eyes when only meet All lid closure blink count REFERENCES
as parameters. The mean below 2 conditions, Dry Extended lid closure count
lid-closure time per Eyes Potential- when meet Superextended lid closure[1]countTimothy I. Morgenthaler,
type of full closure was from 2 4 conditions, and Teoflo Lee-Chiong, Cathy
divided by the the rest is Dry Eyes. Alessi et al. (2007) Practice
Parameters for the Clinical
subjects total For users, it is possible to Evaluation and Treatment of
observation time, and directly enter the above Table 8 Result of measured Circadian Rhythm Sleep
then standardized per parameters of the patient or information Disorders
minute. Because based use the record function to [2] Dr. John Fernandez, Phillip
on the research in the record auto values and Ian Wilson (2006) Facial
Contact rate Value Mean duration
feature detection using Haar
paper(4), we realize that diagnose disease in real- Classifiers
All full lid closure 6.70228 All full lid closure
these parameters differ time. (> 0 second in [3] in
(> 0 second Daniel Llis Baggio, Shervin
noticeably between normal Below is a result of eyes duration) duration) Emami, David Milln Escriv,
eyes and dry eyes. examination after 3 hours Extended lid closure 5.54223 Extended lidKhvedchenia
closure Ievgen, Naureen
For each parameter, we work with computer in a 110 (> 0.1 second in (> 0.1 secondMahmood,
in Jason Saragih, Roy
duration) duration) Shilkrot et al. (2012)
classify them into 3 different seconds eyes examination: Mastering OpenCV with
Superextended lid 2.18019 Superextended lid
smaller groups depending on closure (> 0 second
Practical Computer Vision
closure (> 0 second
the duration of eyes closure. Projects.
Table 6 Personal information in duration) in duration)
Specifically, we have 3 [4] Dr. John Fernandez, Phillip
Ian Wilson (2006) Facial
groups as follows: all full lid feature detection using Haar
closure (> 0 second in Beginning Result of this test is: Dry Classifiers
duration), extended lid time Beginning date Eyes Potential. [5] George W Ousler 3rd, Mark B
closures (> 0.1 second in 7:39:36 25/06/2017 Abelson, Patrick r Johnston et
al. (2014) Blink patterns and
duration) and superextended Another test, after lid-contact times in dry-eye
Name Age watching movie 4 hours and normal subjects
[6] Video Capture using OpenCV
with C++ at
https://www.codeproject.com/
Articles/741055/Video-
Capture-using-OpenCV-with-
VCplusplus.
[7] Computer Vision The
Integral Image at
https://computersciencesource
.wordpress.com
[8]

You might also like