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
b73f22fe
Commit
b73f22fe
authored
Jan 31, 2023
by
Jebarsan dias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
aaadf956
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
attendance /notupdate.py
attendance /notupdate.py
+93
-0
No files found.
attendance /notupdate.py
0 → 100644
View file @
b73f22fe
import
cv2
import
os
import
sys
import
numpy
as
np
from
datetime
import
datetime
from
PyQt5
import
QtGui
,
QtCore
from
PyQt5.QtWidgets
import
QDialog
,
QApplication
,
QMainWindow
,
QMessageBox
from
PyQt5.uic
import
loadUi
class
USER
(
QDialog
):
def
__init__
(
self
):
super
(
USER
,
self
)
.
__init__
()
loadUi
(
"user_info.ui"
,
self
)
def
get_name_key
(
self
):
name
=
self
.
name_label
.
text
()
key
=
int
(
self
.
key_label
.
text
())
return
name
,
key
class
AUFR
(
QMainWindow
):
def
__init__
(
self
):
super
(
AUFR
,
self
)
.
__init__
()
loadUi
(
"mainwindow.ui"
,
self
)
self
.
face_classifier
=
cv2
.
CascadeClassifier
(
"haarcascade_frontalface_default.xml"
)
self
.
eye_classifier
=
cv2
.
CascadeClassifier
(
"haarcascade_eye.xml"
)
self
.
smile_classifier
=
cv2
.
CascadeClassifier
(
"haarcascade_smile.xml"
)
self
.
camera_id
=
0
# can also be a url of Video
self
.
dataset_per_subject
=
50
self
.
ret
=
False
self
.
trained_model
=
0
self
.
image
=
cv2
.
imread
(
""
,
1
)
self
.
modified_image
=
self
.
image
.
copy
()
self
.
draw_text
(
"fyh"
,
40
,
30
,
1
,
(
255
,
255
,
255
))
self
.
display
()
# Actions
self
.
generate_dataset_btn
.
setCheckable
(
True
)
self
.
train_model_btn
.
setCheckable
(
True
)
self
.
recognize_face_btn
.
setCheckable
(
True
)
# Menu
self
.
about_menu
=
self
.
menu_bar
.
addAction
(
"About"
)
self
.
help_menu
=
self
.
menu_bar
.
addAction
(
"Help"
)
self
.
about_menu
.
triggered
.
connect
(
self
.
about_info
)
self
.
help_menu
.
triggered
.
connect
(
self
.
help_info
)
# Algorithms
self
.
algo_radio_group
.
buttonClicked
.
connect
(
self
.
algorithm_radio_changed
)
# Recangle
self
.
face_rect_radio
.
setChecked
(
True
)
self
.
eye_rect_radio
.
setChecked
(
False
)
self
.
smile_rect_radio
.
setChecked
(
False
)
# Events
self
.
generate_dataset_btn
.
clicked
.
connect
(
self
.
generate
)
self
.
train_model_btn
.
clicked
.
connect
(
self
.
train
)
self
.
recognize_face_btn
.
clicked
.
connect
(
self
.
recognize
)
self
.
save_image_btn
.
clicked
.
connect
(
self
.
save_image
)
self
.
video_recording_btn
.
clicked
.
connect
(
self
.
save_video
)
# Recognizers
self
.
update_recognizer
()
self
.
assign_algorithms
()
def
start_timer
(
self
):
# start the timeer for execution.
self
.
capture
=
cv2
.
VideoCapture
(
self
.
camera_id
)
self
.
capture
.
set
(
cv2
.
CAP_PROP_FRAME_HEIGHT
,
480
)
self
.
capture
.
set
(
cv2
.
CAP_PROP_FRAME_WIDTH
,
640
)
self
.
timer
=
QtCore
.
QTimer
()
if
self
.
generate_dataset_btn
.
isChecked
():
self
.
timer
.
timeout
.
connect
(
self
.
save_dataset
)
elif
self
.
recognize_face_btn
.
isChecked
():
self
.
timer
.
timeout
.
connect
(
self
.
update_image
)
self
.
timer
.
start
(
5
)
def
stop_timer
(
self
):
# stop timer or come out of the loop.
self
.
timer
.
stop
()
self
.
ret
=
False
self
.
capture
.
release
()
def
update_image
(
self
):
# update canvas every time according to time set in the timer.
if
self
.
recognize_face_btn
.
isChecked
():
self
.
ret
,
self
.
image
=
self
.
capture
.
read
()
self
.
image
=
cv2
.
flip
(
self
.
image
,
1
)
faces
=
self
.
get_faces
()
self
.
draw_rectangle
(
faces
)
if
self
.
video_recording_btn
.
isChecked
():
self
.
recording
()
self
.
display
()
\ 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