Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Smart E- Learn Tracer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
23_22 - J 01
Smart E- Learn Tracer
Commits
ac68ee8b
Commit
ac68ee8b
authored
Oct 07, 2022
by
Shenthuri Vimaleshwaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This is my 1st commit for my part. this is a small part for the eye concentration.
parent
abaf3567
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
eye.py
eye.py
+39
-0
No files found.
eye.py
0 → 100644
View file @
ac68ee8b
import
cv2
import
os
# Load and create faceCascade Classifier
facePath
=
os
.
path
.
dirname
(
cv2
.
__file__
)
+
"/data/haarcascade_frontalface_default.xml"
faceCascade
=
cv2
.
CascadeClassifier
(
facePath
)
eyePath
=
os
.
path
.
dirname
(
cv2
.
__file__
)
+
"/data/haarcascade_eye.xml"
eyeCascade
=
cv2
.
CascadeClassifier
(
eyePath
)
out
=
cv2
.
VideoWriter
(
'faceEyeDetection.mp4'
,
-
1
,
20.0
,
(
640
,
480
))
video
=
cv2
.
VideoCapture
(
0
)
while
True
:
try
:
ret
,
frames
=
video
.
read
()
gray
=
cv2
.
cvtColor
(
frames
,
cv2
.
COLOR_BGR2GRAY
)
# Face Detection
faces
=
faceCascade
.
detectMultiScale
(
gray
)
for
(
x
,
y
,
w
,
h
)
in
faces
:
cv2
.
rectangle
(
frames
,
(
x
,
y
),
(
x
+
w
,
y
+
h
),
(
255
,
255
,
0
),
2
)
# Eye Detection
eyes
=
eyeCascade
.
detectMultiScale
(
gray
)
for
(
x
,
y
,
w
,
h
)
in
eyes
:
cv2
.
rectangle
(
frames
,
(
x
,
y
),
(
x
+
w
,
y
+
h
),
(
0
,
165
,
255
),
2
)
# Save and Show the Video
out
.
write
(
frames
)
cv2
.
imshow
(
'WebCam'
,
frames
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'q'
):
break
except
Exception
as
e
:
print
(
str
(
e
))
break
video
.
release
()
out
.
release
()
cv2
.
destroyAllWindows
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment