├── .gitignore ├── attendance.csv ├── .gitattributes ├── Images_GUI ├── att.jpg ├── bg.png ├── bg1.jpg ├── bg2.jpg ├── bg3.jpg ├── bg4.png ├── cam.jpg ├── det1.jpg ├── dev.jpg ├── exi.jpg ├── f_bg.jpg ├── fb.png ├── hlp.jpg ├── log.jpg ├── log1.png ├── qr1.png ├── reg1.png ├── std1.jpg ├── tra.jpg ├── tra1.jpg ├── web.png ├── yt.png ├── banner.jpg ├── bgReg.jpg ├── f_det.jpg ├── f_det1.gif ├── gmail.png ├── phong.jpg ├── t_bg1.jpg ├── t_btn1.jpg ├── t_btn1.png ├── banner1.jpg ├── developer.jpg ├── loginBg.jpg ├── loginBg1.jpg ├── face-off-banner.jpg ├── Face-Recognition-Software.png ├── facial-recognition-banner.jpg.jpg ├── Facial-recognition-regulation.webp └── face-recognition-system-concept-human-260nw-1139961602.webp ├── .vscode └── settings.json ├── data_img ├── stdudent.1.1.jpg ├── stdudent.1.10.jpg ├── stdudent.1.11.jpg ├── stdudent.1.12.jpg ├── stdudent.1.13.jpg ├── stdudent.1.14.jpg ├── stdudent.1.15.jpg ├── stdudent.1.16.jpg ├── stdudent.1.17.jpg ├── stdudent.1.18.jpg ├── stdudent.1.19.jpg ├── stdudent.1.2.jpg ├── stdudent.1.20.jpg ├── stdudent.1.21.jpg ├── stdudent.1.22.jpg ├── stdudent.1.23.jpg ├── stdudent.1.24.jpg ├── stdudent.1.25.jpg ├── stdudent.1.26.jpg ├── stdudent.1.27.jpg ├── stdudent.1.28.jpg ├── stdudent.1.29.jpg ├── stdudent.1.3.jpg ├── stdudent.1.30.jpg ├── stdudent.1.31.jpg ├── stdudent.1.32.jpg ├── stdudent.1.33.jpg ├── stdudent.1.34.jpg ├── stdudent.1.35.jpg ├── stdudent.1.36.jpg ├── stdudent.1.37.jpg ├── stdudent.1.38.jpg ├── stdudent.1.39.jpg ├── stdudent.1.4.jpg ├── stdudent.1.40.jpg ├── stdudent.1.41.jpg ├── stdudent.1.42.jpg ├── stdudent.1.43.jpg ├── stdudent.1.44.jpg ├── stdudent.1.45.jpg ├── stdudent.1.46.jpg ├── stdudent.1.47.jpg ├── stdudent.1.48.jpg ├── stdudent.1.49.jpg ├── stdudent.1.5.jpg ├── stdudent.1.50.jpg ├── stdudent.1.51.jpg ├── stdudent.1.52.jpg ├── stdudent.1.53.jpg ├── stdudent.1.54.jpg ├── stdudent.1.55.jpg ├── stdudent.1.56.jpg ├── stdudent.1.57.jpg ├── stdudent.1.58.jpg ├── stdudent.1.59.jpg ├── stdudent.1.6.jpg ├── stdudent.1.60.jpg ├── stdudent.1.61.jpg ├── stdudent.1.62.jpg ├── stdudent.1.63.jpg ├── stdudent.1.64.jpg ├── stdudent.1.65.jpg ├── stdudent.1.66.jpg ├── stdudent.1.67.jpg ├── stdudent.1.68.jpg ├── stdudent.1.69.jpg ├── stdudent.1.7.jpg ├── stdudent.1.70.jpg ├── stdudent.1.71.jpg ├── stdudent.1.72.jpg ├── stdudent.1.73.jpg ├── stdudent.1.74.jpg ├── stdudent.1.75.jpg ├── stdudent.1.76.jpg ├── stdudent.1.77.jpg ├── stdudent.1.78.jpg ├── stdudent.1.79.jpg ├── stdudent.1.8.jpg ├── stdudent.1.80.jpg ├── stdudent.1.81.jpg ├── stdudent.1.82.jpg ├── stdudent.1.83.jpg ├── stdudent.1.84.jpg ├── stdudent.1.85.jpg ├── stdudent.1.86.jpg ├── stdudent.1.87.jpg ├── stdudent.1.88.jpg ├── stdudent.1.89.jpg ├── stdudent.1.9.jpg ├── stdudent.1.90.jpg ├── stdudent.1.91.jpg ├── stdudent.1.92.jpg ├── stdudent.1.93.jpg ├── stdudent.1.94.jpg ├── stdudent.1.95.jpg ├── stdudent.1.96.jpg ├── stdudent.1.97.jpg ├── stdudent.1.98.jpg ├── stdudent.1.99.jpg └── stdudent.1.100.jpg ├── __pycache__ ├── student.cpython-38.pyc ├── train.cpython-310.pyc ├── train.cpython-38.pyc ├── developer.cpython-38.pyc ├── register.cpython-310.pyc ├── register.cpython-38.pyc ├── student.cpython-310.pyc ├── attendance.cpython-310.pyc ├── attendance.cpython-38.pyc ├── developer.cpython-310.pyc ├── helpsupport.cpython-310.pyc ├── helpsupport.cpython-38.pyc ├── face_recognition.cpython-310.pyc └── face_recognition.cpython-38.pyc ├── databaseTest.py ├── README.md ├── developer.py ├── train.py ├── helpsupport.py ├── face_recognition.py ├── register.py ├── main.py ├── login.py ├── attendance.py └── student.py /.gitignore: -------------------------------------------------------------------------------- 1 | dataset/ -------------------------------------------------------------------------------- /attendance.csv: -------------------------------------------------------------------------------- 1 | 2 | 1, 20IT735, phong , 14:35:51, 28/10/2022, Co mat -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Images_GUI/att.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/att.jpg -------------------------------------------------------------------------------- /Images_GUI/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bg.png -------------------------------------------------------------------------------- /Images_GUI/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bg1.jpg -------------------------------------------------------------------------------- /Images_GUI/bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bg2.jpg -------------------------------------------------------------------------------- /Images_GUI/bg3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bg3.jpg -------------------------------------------------------------------------------- /Images_GUI/bg4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bg4.png -------------------------------------------------------------------------------- /Images_GUI/cam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/cam.jpg -------------------------------------------------------------------------------- /Images_GUI/det1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/det1.jpg -------------------------------------------------------------------------------- /Images_GUI/dev.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/dev.jpg -------------------------------------------------------------------------------- /Images_GUI/exi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/exi.jpg -------------------------------------------------------------------------------- /Images_GUI/f_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/f_bg.jpg -------------------------------------------------------------------------------- /Images_GUI/fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/fb.png -------------------------------------------------------------------------------- /Images_GUI/hlp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/hlp.jpg -------------------------------------------------------------------------------- /Images_GUI/log.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/log.jpg -------------------------------------------------------------------------------- /Images_GUI/log1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/log1.png -------------------------------------------------------------------------------- /Images_GUI/qr1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/qr1.png -------------------------------------------------------------------------------- /Images_GUI/reg1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/reg1.png -------------------------------------------------------------------------------- /Images_GUI/std1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/std1.jpg -------------------------------------------------------------------------------- /Images_GUI/tra.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/tra.jpg -------------------------------------------------------------------------------- /Images_GUI/tra1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/tra1.jpg -------------------------------------------------------------------------------- /Images_GUI/web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/web.png -------------------------------------------------------------------------------- /Images_GUI/yt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/yt.png -------------------------------------------------------------------------------- /Images_GUI/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/banner.jpg -------------------------------------------------------------------------------- /Images_GUI/bgReg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/bgReg.jpg -------------------------------------------------------------------------------- /Images_GUI/f_det.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/f_det.jpg -------------------------------------------------------------------------------- /Images_GUI/f_det1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/f_det1.gif -------------------------------------------------------------------------------- /Images_GUI/gmail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/gmail.png -------------------------------------------------------------------------------- /Images_GUI/phong.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/phong.jpg -------------------------------------------------------------------------------- /Images_GUI/t_bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/t_bg1.jpg -------------------------------------------------------------------------------- /Images_GUI/t_btn1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/t_btn1.jpg -------------------------------------------------------------------------------- /Images_GUI/t_btn1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/t_btn1.png -------------------------------------------------------------------------------- /Images_GUI/banner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/banner1.jpg -------------------------------------------------------------------------------- /Images_GUI/developer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/developer.jpg -------------------------------------------------------------------------------- /Images_GUI/loginBg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/loginBg.jpg -------------------------------------------------------------------------------- /Images_GUI/loginBg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/loginBg1.jpg -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "sqltools.connections": [], 3 | "python.pythonPath": "c:\\Users\\Muhammad Waseem\\myPython\\Scripts\\python.exe" 4 | } -------------------------------------------------------------------------------- /data_img/stdudent.1.1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.1.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.10.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.11.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.12.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.13.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.14.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.15.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.16.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.17.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.18.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.19.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.2.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.20.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.21.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.22.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.23.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.24.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.25.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.26.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.27.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.27.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.28.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.29.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.29.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.3.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.30.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.31.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.32.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.32.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.33.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.33.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.34.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.34.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.35.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.35.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.36.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.36.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.37.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.37.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.38.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.38.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.39.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.39.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.4.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.40.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.40.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.41.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.41.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.42.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.42.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.43.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.44.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.44.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.45.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.45.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.46.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.46.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.47.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.47.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.48.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.48.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.49.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.49.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.5.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.50.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.50.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.51.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.51.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.52.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.52.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.53.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.54.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.54.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.55.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.56.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.56.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.57.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.57.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.58.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.59.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.59.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.6.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.60.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.60.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.61.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.61.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.62.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.62.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.63.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.63.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.64.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.64.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.65.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.65.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.66.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.66.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.67.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.67.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.68.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.69.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.69.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.7.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.70.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.71.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.71.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.72.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.72.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.73.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.73.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.74.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.74.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.75.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.75.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.76.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.76.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.77.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.77.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.78.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.78.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.79.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.79.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.8.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.80.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.80.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.81.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.81.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.82.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.82.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.83.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.83.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.84.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.84.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.85.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.85.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.86.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.86.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.87.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.87.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.88.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.88.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.89.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.89.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.9.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.90.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.90.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.91.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.91.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.92.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.92.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.93.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.94.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.94.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.95.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.95.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.96.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.96.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.97.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.97.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.98.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.98.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.99.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.99.jpg -------------------------------------------------------------------------------- /data_img/stdudent.1.100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/data_img/stdudent.1.100.jpg -------------------------------------------------------------------------------- /Images_GUI/face-off-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/face-off-banner.jpg -------------------------------------------------------------------------------- /__pycache__/student.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/student.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/train.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/train.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/developer.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/developer.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/register.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/register.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/register.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/register.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/student.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/student.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/attendance.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/attendance.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/attendance.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/attendance.cpython-38.pyc -------------------------------------------------------------------------------- /__pycache__/developer.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/developer.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/helpsupport.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/helpsupport.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/helpsupport.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/helpsupport.cpython-38.pyc -------------------------------------------------------------------------------- /Images_GUI/Face-Recognition-Software.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/Face-Recognition-Software.png -------------------------------------------------------------------------------- /Images_GUI/facial-recognition-banner.jpg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/facial-recognition-banner.jpg.jpg -------------------------------------------------------------------------------- /__pycache__/face_recognition.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/face_recognition.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/face_recognition.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/__pycache__/face_recognition.cpython-38.pyc -------------------------------------------------------------------------------- /Images_GUI/Facial-recognition-regulation.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/Facial-recognition-regulation.webp -------------------------------------------------------------------------------- /Images_GUI/face-recognition-system-concept-human-260nw-1139961602.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajunlonglive/Attendance_Management_System_Using_Face_Recognition/HEAD/Images_GUI/face-recognition-system-concept-human-260nw-1139961602.webp -------------------------------------------------------------------------------- /databaseTest.py: -------------------------------------------------------------------------------- 1 | import mysql.connector 2 | 3 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 4 | cursor = conn.cursor() 5 | 6 | cursor.execute("show databases") 7 | 8 | data = cursor.fetchall() 9 | 10 | print(data) 11 | 12 | conn.close() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

HTML5 logo 3 |

4 |

A social media app built with Kotlin (Android Studio) with multiple features

5 |

👉 If you like this repo, give it a star ✨ and share 👨🏻‍💻 it to your friends 👈.

6 | 7 | ## ▷ Screenshots: 8 |

9 | image 10 | image 11 | image 12 | image 13 | image 14 | image 15 |

16 | 17 | ## ▷ Features of Project: 18 | 19 | - Real-time face detection 20 | - Loging Security System 21 | -(Username&Password) 22 | - Home Page 23 | - i) Student management system (Save, Take Photo Samples, Update, Delete, Clear) 24 | - ii) Train Photo Samples 25 | - iii) Take Attendance with Face Detection 26 | - iv) Attendance Report (Excel file & MySql database) 27 | - v) Developer Page 28 | - vi) Help Desk 29 | - vii) Exit System 30 | 31 | 32 | ## ▷ Algorithm use: 33 | 34 | - Haarcascade Opencv (Object Detection) 35 | -https://towardsdatascience.com/face-recognition-how-lbph-works-90ec258c3d6b 36 | - LBPH Opencv (Face Recognition) 37 | ## 38 | - Python GUI - tkinter 39 | 40 | ## ▷ Setting up the project 41 | 42 | After cloning the project: 43 | 44 | Start the server: 45 | ```bash 46 | python Face_Recognition_software.py 47 | ``` 48 | in terminal 49 | 50 | ## ▷ Database 51 | 52 | - MySql 53 | -https://dev.mysql.com/doc/ 54 | 55 | ## ▷ Desktop App 56 | - https://drive.google.com/file/d/1ExtmTQwScwp4jEqX7NXDi4VJR4GO0tXh/view?usp=sharing 57 | 58 | 59 | 60 | ## ▷ Author: F.O.G_ntp(nguyenthanhphong) 61 | 62 | 63 | -------------------------------------------------------------------------------- /developer.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import ttk 3 | from train import Train 4 | from PIL import Image,ImageTk 5 | from student import Student 6 | from train import Train 7 | from face_recognition import Face_Recognition 8 | from attendance import Attendance 9 | import os 10 | 11 | class Developer: 12 | def __init__(self,root): 13 | self.root=root 14 | self.root.geometry("1250x700+0+0") 15 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 16 | 17 | # This part is image labels setting start 18 | # first header image 19 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 20 | img=img.resize((1250,120),Image.ANTIALIAS) 21 | self.photoimg=ImageTk.PhotoImage(img) 22 | 23 | # set image as lable 24 | f_lb1 = Label(self.root,image=self.photoimg) 25 | f_lb1.place(x=0,y=0,width=1250,height=120) 26 | 27 | # backgorund image 28 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 29 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 30 | self.photobg1=ImageTk.PhotoImage(bg1) 31 | 32 | # set image as lable 33 | bg_img = Label(self.root,image=self.photobg1) 34 | bg_img.place(x=0,y=130,width=1250,height=768) 35 | 36 | #title section 37 | title_lb1 = Label(bg_img,text="Developer",font=("verdana",30,"bold"),bg="white",fg="navyblue") 38 | title_lb1.place(x=0,y=0,width=1366,height=45) 39 | 40 | # Create buttons below the section 41 | # ------------------------------------------------------------------------------------------------------------------- 42 | 43 | 44 | # Attendance System button 3 45 | att_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\phong.jpg") 46 | att_img_btn=att_img_btn.resize((180,180),Image.ANTIALIAS) 47 | self.att_img1=ImageTk.PhotoImage(att_img_btn) 48 | 49 | att_b1 = Button(bg_img,image=self.att_img1,cursor="hand2",) 50 | att_b1.place(x=550,y=180,width=180,height=200) 51 | 52 | att_b1_1 = Button(bg_img,text="Nguyễn Thanh Phong",cursor="hand2",font=("tahoma",10,"bold"),bg="white",fg="navyblue") 53 | att_b1_1.place(x=550,y=360,width=180,height=45) 54 | 55 | 56 | if __name__ == "__main__": 57 | root=Tk() 58 | obj=Developer(root) 59 | root.mainloop() -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- 1 | from sys import path 2 | from tkinter import* 3 | from tkinter import ttk 4 | from PIL import Image,ImageTk 5 | import os 6 | import mysql.connector 7 | import cv2 8 | import numpy as np 9 | from tkinter import messagebox 10 | 11 | class Train: 12 | 13 | def __init__(self,root): 14 | self.root=root 15 | self.root.geometry("1250x700+0+0") 16 | self.root.title("Tải Dữ Liệu") 17 | 18 | # This part is image labels setting start 19 | # first header image 20 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 21 | img=img.resize((1250,120),Image.ANTIALIAS) 22 | self.photoimg=ImageTk.PhotoImage(img) 23 | 24 | # set image as lable 25 | f_lb1 = Label(self.root,image=self.photoimg) 26 | f_lb1.place(x=0,y=0,width=1250,height=120) 27 | 28 | # backgorund image 29 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 30 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 31 | self.photobg1=ImageTk.PhotoImage(bg1) 32 | 33 | # set image as lable 34 | bg_img = Label(self.root,image=self.photobg1) 35 | bg_img.place(x=0,y=130,width=1250,height=768) 36 | 37 | 38 | 39 | #title section 40 | title_lb1 = Label(bg_img,text="Tải Dữ Liệu Khuôn Mặt",font=("verdana",30,"bold"),bg="white",fg="navyblue") 41 | title_lb1.place(x=0,y=0,width=1366,height=45) 42 | 43 | # Create buttons below the section 44 | # ------------------------------------------------------------------------------------------------------------------- 45 | # Training button 1 46 | std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\t_btn1.png") 47 | std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS) 48 | self.std_img1=ImageTk.PhotoImage(std_img_btn) 49 | 50 | std_b1 = Button(bg_img,command=self.train_classifier,image=self.std_img1,cursor="hand2") 51 | std_b1.place(x=600,y=170,width=180,height=180) 52 | 53 | std_b1_1 = Button(bg_img,command=self.train_classifier,text="Tải Dữ Liệu",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 54 | std_b1_1.place(x=600,y=350,width=180,height=45) 55 | 56 | # ==================Create Function of Traing=================== 57 | def train_classifier(self): 58 | data_dir=("data_img") 59 | path=[os.path.join(data_dir,file) for file in os.listdir(data_dir)] 60 | 61 | faces=[] 62 | ids=[] 63 | 64 | for image in path: 65 | img=Image.open(image).convert('L') # conver in gray scale 66 | imageNp = np.array(img,'uint8') 67 | id=int(os.path.split(image)[1].split('.')[1]) 68 | 69 | faces.append(imageNp) 70 | ids.append(id) 71 | 72 | cv2.imshow("Tải Dữ Liệu",imageNp) 73 | cv2.waitKey(1)==13 74 | 75 | ids=np.array(ids) 76 | 77 | #=================Train Classifier============= 78 | clf= cv2.face.LBPHFaceRecognizer_create() 79 | clf.train(faces,ids) 80 | clf.write("clf.xml") 81 | 82 | cv2.destroyAllWindows() 83 | messagebox.showinfo("Kết quả","Tải dữ liệu thành công!",parent=self.root) 84 | 85 | 86 | 87 | 88 | if __name__ == "__main__": 89 | root=Tk() 90 | obj=Train(root) 91 | root.mainloop() -------------------------------------------------------------------------------- /helpsupport.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from PIL import Image,ImageTk 3 | import webbrowser 4 | 5 | 6 | class Helpsupport: 7 | def __init__(self,root): 8 | self.root=root 9 | self.root.geometry("1250x700+0+0") 10 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 11 | 12 | # This part is image labels setting start 13 | # first header image 14 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 15 | img=img.resize((1250,120),Image.ANTIALIAS) 16 | self.photoimg=ImageTk.PhotoImage(img) 17 | 18 | # set image as lable 19 | f_lb1 = Label(self.root,image=self.photoimg) 20 | f_lb1.place(x=0,y=0,width=1250,height=120) 21 | 22 | # backgorund image 23 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg4.png") 24 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 25 | self.photobg1=ImageTk.PhotoImage(bg1) 26 | 27 | # set image as lable 28 | bg_img = Label(self.root,image=self.photobg1) 29 | bg_img.place(x=0,y=130,width=1250,height=768) 30 | 31 | 32 | #title section 33 | title_lb1 = Label(bg_img,text="Hỗ Trợ",font=("verdana",30,"bold"),bg="white",fg="navyblue") 34 | title_lb1.place(x=0,y=0,width=1366,height=45) 35 | 36 | # Create buttons below the section 37 | # ------------------------------------------------------------------------------------------------------------------- 38 | # student button 1 39 | std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\web.png") 40 | std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS) 41 | self.std_img1=ImageTk.PhotoImage(std_img_btn) 42 | 43 | std_b1 = Button(bg_img,command=self.website,image=self.std_img1,cursor="hand2") 44 | std_b1.place(x=250,y=200,width=180,height=180) 45 | 46 | std_b1_1 = Button(bg_img,command=self.website,text="Website",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 47 | std_b1_1.place(x=250,y=380,width=180,height=45) 48 | 49 | # Detect Face button 2 50 | det_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\fb.png") 51 | det_img_btn=det_img_btn.resize((180,180),Image.ANTIALIAS) 52 | self.det_img1=ImageTk.PhotoImage(det_img_btn) 53 | 54 | det_b1 = Button(bg_img,command=self.facebook,image=self.det_img1,cursor="hand2",) 55 | det_b1.place(x=480,y=200,width=180,height=180) 56 | 57 | det_b1_1 = Button(bg_img,command=self.facebook,text="Facebook",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 58 | det_b1_1.place(x=480,y=380,width=180,height=45) 59 | 60 | # Attendance System button 3 61 | att_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\yt.png") 62 | att_img_btn=att_img_btn.resize((180,180),Image.ANTIALIAS) 63 | self.att_img1=ImageTk.PhotoImage(att_img_btn) 64 | 65 | att_b1 = Button(bg_img,command=self.youtube,image=self.att_img1,cursor="hand2",) 66 | att_b1.place(x=710,y=200,width=180,height=180) 67 | 68 | att_b1_1 = Button(bg_img,command=self.youtube,text="Youtube",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 69 | att_b1_1.place(x=710,y=380,width=180,height=45) 70 | 71 | # Help Support button 4 72 | hlp_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\gmail.png") 73 | hlp_img_btn=hlp_img_btn.resize((180,180),Image.ANTIALIAS) 74 | self.hlp_img1=ImageTk.PhotoImage(hlp_img_btn) 75 | 76 | hlp_b1 = Button(bg_img,command=self.gmail,image=self.hlp_img1,cursor="hand2",) 77 | hlp_b1.place(x=940,y=200,width=180,height=180) 78 | 79 | hlp_b1_1 = Button(bg_img,command=self.gmail,text="Gmail",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 80 | hlp_b1_1.place(x=940,y=380,width=180,height=45) 81 | 82 | 83 | # create function for button 84 | 85 | 86 | def website(self): 87 | self.new = 1 88 | self.url = "http://www.stemsquare.vn/" 89 | webbrowser.open(self.url,new=self.new) 90 | 91 | def facebook(self): 92 | self.new = 1 93 | self.url = "https://www.facebook.com/stemsquare" 94 | webbrowser.open(self.url,new=self.new) 95 | 96 | def youtube(self): 97 | self.new = 1 98 | self.url = "https://www.youtube.com/channel/UCzmueccz-WuanzMaJ1ds1Tg" 99 | webbrowser.open(self.url,new=self.new) 100 | 101 | def gmail(self): 102 | self.new = 1 103 | self.url = "https://www.gmail.com" 104 | webbrowser.open(self.url,new=self.new) 105 | 106 | 107 | 108 | 109 | 110 | 111 | if __name__ == "__main__": 112 | root=Tk() 113 | obj=Helpsupport(root) 114 | root.mainloop() -------------------------------------------------------------------------------- /face_recognition.py: -------------------------------------------------------------------------------- 1 | # import re 2 | from sys import path 3 | from tkinter import* 4 | from tkinter import ttk 5 | from PIL import Image,ImageTk 6 | import os 7 | import mysql.connector 8 | import cv2 9 | import numpy as np 10 | from tkinter import messagebox 11 | from time import strftime 12 | from datetime import datetime 13 | class Face_Recognition: 14 | 15 | def __init__(self,root): 16 | self.root=root 17 | self.root.geometry("1250x700+0+0") 18 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 19 | 20 | # This part is image labels setting start 21 | # first header image 22 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 23 | img=img.resize((1250,120),Image.ANTIALIAS) 24 | self.photoimg=ImageTk.PhotoImage(img) 25 | 26 | # set image as lable 27 | f_lb1 = Label(self.root,image=self.photoimg) 28 | f_lb1.place(x=0,y=0,width=1250,height=120) 29 | 30 | # backgorund image 31 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 32 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 33 | self.photobg1=ImageTk.PhotoImage(bg1) 34 | 35 | # set image as lable 36 | bg_img = Label(self.root,image=self.photobg1) 37 | bg_img.place(x=0,y=130,width=1250,height=768) 38 | 39 | #title section 40 | title_lb1 = Label(bg_img,text="Chào mừng đến với hệ thống nhận diện khuôn mặt",font=("verdana",30,"bold"),bg="white",fg="navyblue") 41 | title_lb1.place(x=0,y=0,width=1250,height=40) 42 | 43 | # Create buttons below the section 44 | # ------------------------------------------------------------------------------------------------------------------- 45 | # Training button 1 46 | std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\f_det.jpg") 47 | std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS) 48 | self.std_img1=ImageTk.PhotoImage(std_img_btn) 49 | 50 | std_b1 = Button(bg_img,command=self.face_recog,image=self.std_img1,cursor="hand2") 51 | std_b1.place(x=600,y=170,width=180,height=180) 52 | 53 | std_b1_1 = Button(bg_img,command=self.face_recog,text="Nhận Diện",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 54 | std_b1_1.place(x=600,y=350,width=180,height=45) 55 | #=====================Attendance=================== 56 | 57 | def mark_attendance(self,i,r,n): 58 | with open("attendance.csv","r+",newline="\n") as f: 59 | myDatalist=f.readlines() 60 | name_list=[] 61 | for line in myDatalist: 62 | entry=line.split((",")) 63 | name_list.append(entry[0]) 64 | 65 | if((i not in name_list)) and ((r not in name_list)) and ((n not in name_list)): 66 | now=datetime.now() 67 | d1=now.strftime("%d/%m/%Y") 68 | dtString=now.strftime("%H:%M:%S") 69 | f.writelines(f"\n{i}, {r}, {n}, {dtString}, {d1}, Co mat") 70 | 71 | 72 | #================face recognition================== 73 | def face_recog(self): 74 | def draw_boundray(img,classifier,scaleFactor,minNeighbors,color,text,clf): 75 | gray_image=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) 76 | featuers=classifier.detectMultiScale(gray_image,scaleFactor,minNeighbors) 77 | coord=[] 78 | for (x,y,w,h) in featuers: 79 | cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),3) 80 | id,predict=clf.predict(gray_image[y:y+h,x:x+w]) 81 | confidence=int((100*(1-predict/300))) 82 | 83 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 84 | cursor = conn.cursor() 85 | 86 | cursor.execute("select Name from student where Student_ID="+str(id)) 87 | n=cursor.fetchone() 88 | n="+".join(n) 89 | 90 | cursor.execute("select Roll_No from student where Student_ID="+str(id)) 91 | r=cursor.fetchone() 92 | r="+".join(r) 93 | 94 | cursor.execute("select Student_ID from student where Student_ID="+str(id)) 95 | i=cursor.fetchone() 96 | i="+".join(i) 97 | 98 | 99 | if confidence > 77: 100 | cv2.putText(img,f"Student_ID:{i}",(x,y-80),cv2.FONT_HERSHEY_COMPLEX,0.8,(64,15,223),2) 101 | cv2.putText(img,f"Name:{n}",(x,y-55),cv2.FONT_HERSHEY_COMPLEX,0.8,(64,15,223),2) 102 | cv2.putText(img,f"Roll-No:{r}",(x,y-30),cv2.FONT_HERSHEY_COMPLEX,0.8,(64,15,223),2) 103 | self.mark_attendance(i,r,n) 104 | else: 105 | cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),3) 106 | cv2.putText(img,"Unknown Face",(x,y-5),cv2.FONT_HERSHEY_COMPLEX,0.8,(255,255,0),3) 107 | 108 | coord=[x,y,w,y] 109 | 110 | return coord 111 | 112 | 113 | #========== 114 | def recognize(img,clf,faceCascade): 115 | coord=draw_boundray(img,faceCascade,1.1,10,(255,25,255),"Face",clf) 116 | return img 117 | 118 | faceCascade=cv2.CascadeClassifier("haarcascade_frontalface_default.xml") 119 | clf=cv2.face.LBPHFaceRecognizer_create() 120 | clf.read("clf.xml") 121 | 122 | videoCap=cv2.VideoCapture(0) 123 | 124 | while True: 125 | ret,img=videoCap.read() 126 | img=recognize(img,clf,faceCascade) 127 | cv2.imshow("Nhận Diện",img) 128 | 129 | if cv2.waitKey(1) == 13: 130 | break 131 | videoCap.release() 132 | cv2.destroyAllWindows() 133 | 134 | 135 | 136 | 137 | if __name__ == "__main__": 138 | root=Tk() 139 | obj=Face_Recognition(root) 140 | root.mainloop() -------------------------------------------------------------------------------- /register.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import ttk 3 | from PIL import Image,ImageTk 4 | from tkinter import messagebox 5 | import mysql.connector 6 | 7 | class Register: 8 | def __init__(self,root): 9 | self.root=root 10 | self.root.title("Đăng Ký") 11 | self.root.geometry("1250x700+0+0") 12 | 13 | # ============ Variables ================= 14 | self.var_fname=StringVar() 15 | self.var_lname=StringVar() 16 | self.var_cnum=StringVar() 17 | self.var_email=StringVar() 18 | self.var_ssq=StringVar() 19 | self.var_sa=StringVar() 20 | self.var_pwd=StringVar() 21 | self.var_cpwd=StringVar() 22 | self.var_check=IntVar() 23 | 24 | self.bg=ImageTk.PhotoImage(file=r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bgReg.jpg") 25 | 26 | lb1_bg=Label(self.root,image=self.bg) 27 | lb1_bg.place(x=0,y=0, relwidth=1,relheight=1) 28 | 29 | frame= Frame(self.root,bg="#F2F2F2") 30 | frame.place(x=100,y=40,width=900,height=560) 31 | 32 | 33 | # img1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\reg1.png") 34 | # img1=img1.resize((450,100),Image.ANTIALIAS) 35 | # self.photoimage1=ImageTk.PhotoImage(img1) 36 | # lb1img1 = Label(image=self.photoimage1,bg="#F2F2F2") 37 | # lb1img1.place(x=300,y=100, width=500,height=100) 38 | 39 | 40 | get_str = Label(frame,text="Đăng Ký",font=("times new roman",30,"bold"),fg="#002B53",bg="#F2F2F2") 41 | get_str.place(x=350,y=100) 42 | 43 | #label1 44 | fname =lb1= Label(frame,text="Họ:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 45 | fname.place(x=100,y=200) 46 | 47 | #entry1 48 | self.txtuser=ttk.Entry(frame,textvariable=self.var_fname,font=("times new roman",15,"bold")) 49 | self.txtuser.place(x=103,y=225,width=270) 50 | 51 | 52 | #label2 53 | lname =lb1= Label(frame,text="Tên:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 54 | lname.place(x=100,y=270) 55 | 56 | #entry2 57 | self.txtpwd=ttk.Entry(frame,textvariable=self.var_lname,font=("times new roman",15,"bold")) 58 | self.txtpwd.place(x=103,y=295,width=270) 59 | 60 | # ==================== section 2 -------- 2nd Columan=================== 61 | 62 | #label1 63 | cnum =lb1= Label(frame,text="Liên hệ:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 64 | cnum.place(x=530,y=200) 65 | 66 | #entry1 67 | self.txtuser=ttk.Entry(frame,textvariable=self.var_cnum,font=("times new roman",15,"bold")) 68 | self.txtuser.place(x=533,y=225,width=270) 69 | 70 | 71 | #label2 72 | email =lb1= Label(frame,text="Email:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 73 | email.place(x=530,y=270) 74 | 75 | #entry2 76 | self.txtpwd=ttk.Entry(frame,textvariable=self.var_email,font=("times new roman",15,"bold")) 77 | self.txtpwd.place(x=533,y=295,width=270) 78 | 79 | # ========================= Section 3 --- 1 Columan================= 80 | 81 | #label1 82 | ssq =lb1= Label(frame,text="Câu hỏi bảo mật:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 83 | ssq.place(x=100,y=350) 84 | 85 | #Combo Box1 86 | self.combo_security = ttk.Combobox(frame,textvariable=self.var_ssq,font=("times new roman",15,"bold"),state="readonly") 87 | self.combo_security["values"]=("Select","Ngày tháng sinh","Nick Name","Sách yêu thích") 88 | self.combo_security.current(0) 89 | self.combo_security.place(x=103,y=375,width=270) 90 | 91 | 92 | #label2 93 | sa =lb1= Label(frame,text="Câu trả lời:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 94 | sa.place(x=100,y=420) 95 | 96 | #entry2 97 | self.txtpwd=ttk.Entry(frame,textvariable=self.var_sa,font=("times new roman",15,"bold")) 98 | self.txtpwd.place(x=103,y=445,width=270) 99 | 100 | # ========================= Section 4-----Column 2============================= 101 | 102 | #label1 103 | pwd =lb1= Label(frame,text="mật khẩu:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 104 | pwd.place(x=530,y=350) 105 | 106 | #entry1 107 | self.txtuser=ttk.Entry(frame,textvariable=self.var_pwd,font=("times new roman",15,"bold")) 108 | self.txtuser.place(x=533,y=375,width=270) 109 | 110 | 111 | #label2 112 | cpwd =lb1= Label(frame,text="Nhắc lại mật khẩu:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 113 | cpwd.place(x=530,y=420) 114 | 115 | #entry2 116 | self.txtpwd=ttk.Entry(frame,textvariable=self.var_cpwd,font=("times new roman",15,"bold")) 117 | self.txtpwd.place(x=533,y=445,width=270) 118 | 119 | # Checkbutton 120 | checkbtn = Checkbutton(frame,variable=self.var_check,text="Đồng ý các điều khoản",font=("times new roman",13,"bold"),fg="#002B53",bg="#F2F2F2") 121 | checkbtn.place(x=100,y=480,width=270) 122 | 123 | 124 | # Creating Button Register 125 | loginbtn=Button(frame,command=self.reg,text="Đăng Ký",font=("times new roman",15,"bold"),bd=0,relief=RIDGE,fg="#fff",bg="#002B53",activeforeground="white",activebackground="#007ACC") 126 | loginbtn.place(x=103,y=510,width=270,height=35) 127 | 128 | # Creating Button Login 129 | loginbtn=Button(frame,text="Đăng Nhập",font=("times new roman",15,"bold"),bd=0,relief=RIDGE,fg="#fff",bg="#002B53",activeforeground="white",activebackground="#007ACC") 130 | loginbtn.place(x=533,y=510,width=270,height=35) 131 | 132 | 133 | 134 | 135 | def reg(self): 136 | if (self.var_fname.get()=="" or self.var_lname.get()=="" or self.var_cnum.get()=="" or self.var_email.get()=="" or self.var_ssq.get()=="Select" or self.var_sa.get()=="" or self.var_pwd.get()=="" or self.var_cpwd.get()==""): 137 | messagebox.showerror("Error","Tất cả các trường bắt buộc!") 138 | elif(self.var_pwd.get() != self.var_cpwd.get()): 139 | messagebox.showerror("Error","Vui lòng nhập mật khẩu và xác nhận mật khẩu giống nhau!") 140 | elif(self.var_check.get()==0): 141 | messagebox.showerror("Error","Vui lòng kiểm tra các Điều khoản và Điều kiện đã Thỏa thuận!") 142 | else: 143 | # messagebox.showinfo("Successfully","Successfully Register!") 144 | try: 145 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 146 | mycursor = conn.cursor() 147 | query=("select * from regteach where email=%s") 148 | value=(self.var_email.get(),) 149 | mycursor.execute(query,value) 150 | row=mycursor.fetchone() 151 | if row!=None: 152 | messagebox.showerror("Error","Người dùng đã tồn tại, vui lòng thử một email khác") 153 | else: 154 | mycursor.execute("insert into regteach values(%s,%s,%s,%s,%s,%s,%s)",( 155 | self.var_fname.get(), 156 | self.var_lname.get(), 157 | self.var_cnum.get(), 158 | self.var_email.get(), 159 | self.var_ssq.get(), 160 | self.var_sa.get(), 161 | self.var_pwd.get() 162 | )) 163 | 164 | conn.commit() 165 | conn.close() 166 | messagebox.showinfo("Success","Đăng ký thành công!",parent=self.root) 167 | except Exception as es: 168 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 169 | 170 | 171 | 172 | 173 | if __name__ == "__main__": 174 | root=Tk() 175 | app=Register(root) 176 | root.mainloop() -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import ttk 3 | from train import Train 4 | from PIL import Image,ImageTk 5 | from student import Student 6 | from train import Train 7 | from face_recognition import Face_Recognition 8 | from attendance import Attendance 9 | from developer import Developer 10 | import os 11 | from helpsupport import Helpsupport 12 | 13 | class Face_Recognition_System: 14 | def __init__(self,root): 15 | self.root=root 16 | self.root.geometry("1250x700+0+0") 17 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 18 | 19 | # This part is image labels setting start 20 | # first header image 21 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 22 | img=img.resize((1250,120),Image.ANTIALIAS) 23 | self.photoimg=ImageTk.PhotoImage(img) 24 | 25 | # set image as lable 26 | f_lb1 = Label(self.root,image=self.photoimg) 27 | f_lb1.place(x=0,y=0,width=1250,height=120) 28 | 29 | # backgorund image 30 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 31 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 32 | self.photobg1=ImageTk.PhotoImage(bg1) 33 | 34 | # set image as lable 35 | bg_img = Label(self.root,image=self.photobg1) 36 | bg_img.place(x=0,y=130,width=1250,height=768) 37 | 38 | 39 | #title section 40 | title_lb1 = Label(bg_img,text="Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt",font=("verdana",20,"bold"),bg="white",fg="navyblue") 41 | title_lb1.place(x=0,y=0,width=1250,height=40) 42 | 43 | # Create buttons below the section 44 | # ------------------------------------------------------------------------------------------------------------------- 45 | # student button 1 46 | std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\std1.jpg") 47 | std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS) 48 | self.std_img1=ImageTk.PhotoImage(std_img_btn) 49 | 50 | std_b1 = Button(bg_img,command=self.student_pannels,image=self.std_img1,cursor="hand2") 51 | std_b1.place(x=220,y=100,width=180,height=180) 52 | 53 | std_b1_1 = Button(bg_img,command=self.student_pannels,text="Sinh Viên",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 54 | std_b1_1.place(x=220,y=250,width=180,height=40) 55 | 56 | # Detect Face button 2 57 | det_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\det1.jpg") 58 | det_img_btn=det_img_btn.resize((180,180),Image.ANTIALIAS) 59 | self.det_img1=ImageTk.PhotoImage(det_img_btn) 60 | 61 | det_b1 = Button(bg_img,command=self.face_rec,image=self.det_img1,cursor="hand2",) 62 | det_b1.place(x=450,y=100,width=180,height=180) 63 | 64 | det_b1_1 = Button(bg_img,command=self.face_rec,text="Nhận Diện",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 65 | det_b1_1.place(x=450,y=250,width=180,height=40) 66 | 67 | # Attendance System button 3 68 | att_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\att.jpg") 69 | att_img_btn=att_img_btn.resize((180,180),Image.ANTIALIAS) 70 | self.att_img1=ImageTk.PhotoImage(att_img_btn) 71 | 72 | att_b1 = Button(bg_img,command=self.attendance_pannel,image=self.att_img1,cursor="hand2",) 73 | att_b1.place(x=680,y=100,width=180,height=180) 74 | 75 | att_b1_1 = Button(bg_img,command=self.attendance_pannel,text="Điểm Danh",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 76 | att_b1_1.place(x=680,y=250,width=180,height=40) 77 | 78 | # Help Support button 4 79 | hlp_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\hlp.jpg") 80 | hlp_img_btn=hlp_img_btn.resize((180,180),Image.ANTIALIAS) 81 | self.hlp_img1=ImageTk.PhotoImage(hlp_img_btn) 82 | 83 | hlp_b1 = Button(bg_img,command=self.helpSupport,image=self.hlp_img1,cursor="hand2",) 84 | hlp_b1.place(x=910,y=100,width=180,height=180) 85 | 86 | hlp_b1_1 = Button(bg_img,command=self.helpSupport,text="Hỗ Trợ",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 87 | hlp_b1_1.place(x=910,y=250,width=180,height=40) 88 | 89 | # Top 4 buttons end....... 90 | # --------------------------------------------------------------------------------------------------------------------------- 91 | # Start below buttons......... 92 | # Train button 5 93 | tra_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\tra1.jpg") 94 | tra_img_btn=tra_img_btn.resize((180,180),Image.ANTIALIAS) 95 | self.tra_img1=ImageTk.PhotoImage(tra_img_btn) 96 | 97 | tra_b1 = Button(bg_img,command=self.train_pannels,image=self.tra_img1,cursor="hand2",) 98 | tra_b1.place(x=220,y=300,width=180,height=180) 99 | 100 | tra_b1_1 = Button(bg_img,command=self.train_pannels,text="Tải Data",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 101 | tra_b1_1.place(x=220,y=450,width=180,height=40) 102 | 103 | # Photo button 6 104 | pho_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\qr1.png") 105 | pho_img_btn=pho_img_btn.resize((180,180),Image.ANTIALIAS) 106 | self.pho_img1=ImageTk.PhotoImage(pho_img_btn) 107 | 108 | pho_b1 = Button(bg_img,command=self.open_img,image=self.pho_img1,cursor="hand2",) 109 | pho_b1.place(x=450,y=300,width=180,height=180) 110 | 111 | pho_b1_1 = Button(bg_img,command=self.open_img,text="QR-Codes",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 112 | pho_b1_1.place(x=450,y=450,width=180,height=40) 113 | 114 | # Developers button 7 115 | dev_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\dev.jpg") 116 | dev_img_btn=dev_img_btn.resize((180,180),Image.ANTIALIAS) 117 | self.dev_img1=ImageTk.PhotoImage(dev_img_btn) 118 | 119 | dev_b1 = Button(bg_img,command=self.developr,image=self.dev_img1,cursor="hand2",) 120 | dev_b1.place(x=680,y=300,width=180,height=180) 121 | 122 | dev_b1_1 = Button(bg_img,command=self.developr,text="Developers",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 123 | dev_b1_1.place(x=680,y=450,width=180,height=40) 124 | 125 | # exit button 8 126 | exi_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\exi.jpg") 127 | exi_img_btn=exi_img_btn.resize((180,180),Image.ANTIALIAS) 128 | self.exi_img1=ImageTk.PhotoImage(exi_img_btn) 129 | 130 | exi_b1 = Button(bg_img,command=self.Close,image=self.exi_img1,cursor="hand2",) 131 | exi_b1.place(x=910,y=300,width=180,height=180) 132 | 133 | exi_b1_1 = Button(bg_img,command=self.Close,text="Thoát",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 134 | exi_b1_1.place(x=910,y=450,width=180,height=40) 135 | 136 | # ==================Funtion for Open Images Folder================== 137 | def open_img(self): 138 | os.startfile("dataset") 139 | # ==================Functions Buttons===================== 140 | def student_pannels(self): 141 | self.new_window=Toplevel(self.root) 142 | self.app=Student(self.new_window) 143 | 144 | def train_pannels(self): 145 | self.new_window=Toplevel(self.root) 146 | self.app=Train(self.new_window) 147 | 148 | def face_rec(self): 149 | self.new_window=Toplevel(self.root) 150 | self.app=Face_Recognition(self.new_window) 151 | 152 | def attendance_pannel(self): 153 | self.new_window=Toplevel(self.root) 154 | self.app=Attendance(self.new_window) 155 | 156 | def developr(self): 157 | self.new_window=Toplevel(self.root) 158 | self.app=Developer(self.new_window) 159 | 160 | def helpSupport(self): 161 | self.new_window=Toplevel(self.root) 162 | self.app=Helpsupport(self.new_window) 163 | 164 | def Close(self): 165 | root.destroy() 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | if __name__ == "__main__": 174 | root=Tk() 175 | obj=Face_Recognition_System(root) 176 | root.mainloop() 177 | -------------------------------------------------------------------------------- /login.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import ttk 3 | from PIL import Image,ImageTk 4 | from tkinter import messagebox 5 | from register import Register 6 | import mysql.connector 7 | # -------------------------- 8 | from train import Train 9 | from student import Student 10 | from train import Train 11 | from face_recognition import Face_Recognition 12 | from attendance import Attendance 13 | from developer import Developer 14 | from helpsupport import Helpsupport 15 | import os 16 | 17 | 18 | class Login: 19 | def __init__(self,root): 20 | self.root=root 21 | self.root.title("Đăng Nhập") 22 | self.root.geometry("1250x700+0+0") 23 | 24 | # variables 25 | self.var_ssq=StringVar() 26 | self.var_sa=StringVar() 27 | self.var_pwd=StringVar() 28 | 29 | self.bg=ImageTk.PhotoImage(file=r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\loginBg1.jpg") 30 | 31 | lb1_bg=Label(self.root,image=self.bg) 32 | lb1_bg.place(x=0,y=0, relwidth=1,relheight=1) 33 | 34 | frame1= Frame(self.root,bg="#002B53") 35 | frame1.place(x=500,y=120,width=340,height=450) 36 | 37 | img1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\log1.png") 38 | img1=img1.resize((100,100),Image.ANTIALIAS) 39 | self.photoimage1=ImageTk.PhotoImage(img1) 40 | lb1img1 = Label(image=self.photoimage1,bg="#002B53") 41 | lb1img1.place(x=620,y=125, width=100,height=100) 42 | 43 | get_str = Label(frame1,text="Đăng Nhập",font=("times new roman",20,"bold"),fg="white",bg="#002B53") 44 | get_str.place(x=100,y=100) 45 | 46 | #label1 47 | username =lb1= Label(frame1,text="Email:",font=("times new roman",15,"bold"),fg="white",bg="#002B53") 48 | username.place(x=30,y=160) 49 | 50 | #entry1 51 | self.txtuser=ttk.Entry(frame1,font=("times new roman",15,"bold")) 52 | self.txtuser.place(x=33,y=190,width=270) 53 | 54 | 55 | #label2 56 | pwd =lb1= Label(frame1,text="Mật khẩu:",font=("times new roman",15,"bold"),fg="white",bg="#002B53") 57 | pwd.place(x=30,y=230) 58 | 59 | #entry2 60 | self.txtpwd=ttk.Entry(frame1,font=("times new roman",15,"bold")) 61 | self.txtpwd.place(x=33,y=260,width=270) 62 | 63 | 64 | # Creating Button Login 65 | loginbtn=Button(frame1,command=self.login,text="Đăng Nhập",font=("times new roman",15,"bold"),bd=0,relief=RIDGE,fg="#002B53",bg="white",activeforeground="white",activebackground="#007ACC") 66 | loginbtn.place(x=33,y=320,width=270,height=35) 67 | 68 | 69 | # Creating Button Registration 70 | loginbtn=Button(frame1,command=self.reg,text="Đăng ký",font=("times new roman",10,"bold"),bd=0,relief=RIDGE,fg="white",bg="#002B53",activeforeground="orange",activebackground="#002B53") 71 | loginbtn.place(x=33,y=370,width=50,height=20) 72 | 73 | 74 | # Creating Button Forget 75 | loginbtn=Button(frame1,command=self.forget_pwd,text="Quên MK",font=("times new roman",10,"bold"),bd=0,relief=RIDGE,fg="white",bg="#002B53",activeforeground="orange",activebackground="#002B53") 76 | loginbtn.place(x=90,y=370,width=50,height=20) 77 | 78 | 79 | # THis function is for open register window 80 | def reg(self): 81 | self.new_window=Toplevel(self.root) 82 | self.app=Register(self.new_window) 83 | 84 | 85 | def login(self): 86 | if (self.txtuser.get()=="" or self.txtpwd.get()==""): 87 | messagebox.showerror("Error","Tất cả các trường bắt buộc!") 88 | elif(self.txtuser.get()=="admin" and self.txtpwd.get()=="admin"): 89 | messagebox.showinfo("Sussessfully","Chào mừng bạn đến với Hệ thống quản lý điểm danh bằng nhận diện khuôn mặt") 90 | else: 91 | # messagebox.showerror("Error","Please Check Username or Password !") 92 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 93 | mycursor = conn.cursor() 94 | mycursor.execute("select * from regteach where email=%s and pwd=%s",( 95 | self.txtuser.get(), 96 | self.txtpwd.get() 97 | )) 98 | row=mycursor.fetchone() 99 | if row==None: 100 | messagebox.showerror("Error","Email và mật khẩu không hợp lệ!") 101 | else: 102 | open_min=messagebox.askyesno("Admin","Chỉ truy cập quản trị viên") 103 | if open_min>0: 104 | self.new_window=Toplevel(self.root) 105 | self.app=Face_Recognition_System(self.new_window) 106 | else: 107 | if not open_min: 108 | return 109 | conn.commit() 110 | conn.close() 111 | #=======================Reset Passowrd Function============================= 112 | def reset_pass(self): 113 | if self.var_ssq.get()=="Select": 114 | messagebox.showerror("Error","Chọn câu hỏi bảo mật!",parent=self.root2) 115 | elif(self.var_sa.get()==""): 116 | messagebox.showerror("Error","Vui lòng nhập câu trả lời!",parent=self.root2) 117 | elif(self.var_pwd.get()==""): 118 | messagebox.showerror("Error","Vui lòng nhập mật khẩu mới!",parent=self.root2) 119 | else: 120 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 121 | mycursor = conn.cursor() 122 | query=("select * from regteach where email=%s and ss_que=%s and s_ans=%s") 123 | value=(self.txtuser.get(),self.var_ssq.get(),self.var_sa.get()) 124 | mycursor.execute(query,value) 125 | row=mycursor.fetchone() 126 | if row==None: 127 | messagebox.showerror("Error","Vui lòng nhập câu trả lời đúng!",parent=self.root2) 128 | else: 129 | query=("update regteach set pwd=%s where email=%s") 130 | value=(self.var_pwd.get(),self.txtuser.get()) 131 | mycursor.execute(query,value) 132 | 133 | conn.commit() 134 | conn.close() 135 | messagebox.showinfo("Info","Thành công Mật khẩu của bạn đã được đặt lại, Vui lòng đăng nhập bằng Mật khẩu mới!",parent=self.root2) 136 | 137 | 138 | 139 | 140 | # =====================Forget window========================================= 141 | def forget_pwd(self): 142 | if self.txtuser.get()=="": 143 | messagebox.showerror("Error","Vui lòng nhập ID Email để đặt lại Mật khẩu!") 144 | else: 145 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 146 | mycursor = conn.cursor() 147 | query=("select * from regteach where email=%s") 148 | value=(self.txtuser.get(),) 149 | mycursor.execute(query,value) 150 | row=mycursor.fetchone() 151 | # print(row) 152 | 153 | if row==None: 154 | messagebox.showerror("Error","Vui lòng nhập ID email hợp lệ!") 155 | else: 156 | conn.close() 157 | self.root2=Toplevel() 158 | self.root2.title("Quên MK") 159 | self.root2.geometry("400x400+610+170") 160 | l=Label(self.root2,text="Quên MK",font=("times new roman",30,"bold"),fg="#002B53",bg="#fff") 161 | l.place(x=0,y=10,relwidth=1) 162 | # -------------------fields------------------- 163 | #label1 164 | ssq =lb1= Label(self.root2,text="Chọn câu hỏi bảo mật:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 165 | ssq.place(x=70,y=80) 166 | 167 | #Combo Box1 168 | self.combo_security = ttk.Combobox(self.root2,textvariable=self.var_ssq,font=("times new roman",15,"bold"),state="readonly") 169 | self.combo_security["values"]=("Chọn","Ngày tháng sinh","Nick Name","Sách yêu thích") 170 | self.combo_security.current(0) 171 | self.combo_security.place(x=70,y=110,width=270) 172 | 173 | 174 | #label2 175 | sa =lb1= Label(self.root2,text="Câu trả lời:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 176 | sa.place(x=70,y=150) 177 | 178 | #entry2 179 | self.txtpwd=ttk.Entry(self.root2,textvariable=self.var_sa,font=("times new roman",15,"bold")) 180 | self.txtpwd.place(x=70,y=180,width=270) 181 | 182 | #label2 183 | new_pwd =lb1= Label(self.root2,text="Mật khẩu mới:",font=("times new roman",15,"bold"),fg="#002B53",bg="#F2F2F2") 184 | new_pwd.place(x=70,y=220) 185 | 186 | #entry2 187 | self.new_pwd=ttk.Entry(self.root2,textvariable=self.var_pwd,font=("times new roman",15,"bold")) 188 | self.new_pwd.place(x=70,y=250,width=270) 189 | 190 | # Creating Button New Password 191 | loginbtn=Button(self.root2,command=self.reset_pass,text="Đặt lại MK",font=("times new roman",15,"bold"),bd=0,relief=RIDGE,fg="#fff",bg="#002B53",activeforeground="white",activebackground="#007ACC") 192 | loginbtn.place(x=70,y=300,width=270,height=35) 193 | 194 | 195 | 196 | 197 | # =====================main program Face deteion system==================== 198 | 199 | class Face_Recognition_System: 200 | def __init__(self,root): 201 | self.root=root 202 | self.root.geometry("1250x700+0+0") 203 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 204 | 205 | # This part is image labels setting start 206 | # first header image 207 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 208 | img=img.resize((1366,130),Image.ANTIALIAS) 209 | self.photoimg=ImageTk.PhotoImage(img) 210 | 211 | # set image as lable 212 | f_lb1 = Label(self.root,image=self.photoimg) 213 | f_lb1.place(x=0,y=0,width=1250,height=120) 214 | 215 | # backgorund image 216 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 217 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 218 | self.photobg1=ImageTk.PhotoImage(bg1) 219 | 220 | # set image as lable 221 | bg_img = Label(self.root,image=self.photobg1) 222 | bg_img.place(x=0,y=130,width=1250,height=768) 223 | 224 | 225 | #title section 226 | title_lb1 = Label(bg_img,text="Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt",font=("verdana",20,"bold"),bg="white",fg="navyblue") 227 | title_lb1.place(x=0,y=0,width=1250,height=45) 228 | 229 | # Create buttons below the section 230 | # ------------------------------------------------------------------------------------------------------------------- 231 | # student button 1 232 | std_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\std1.jpg") 233 | std_img_btn=std_img_btn.resize((180,180),Image.ANTIALIAS) 234 | self.std_img1=ImageTk.PhotoImage(std_img_btn) 235 | 236 | std_b1 = Button(bg_img,command=self.student_pannels,image=self.std_img1,cursor="hand2") 237 | std_b1.place(x=220,y=100,width=180,height=180) 238 | 239 | std_b1_1 = Button(bg_img,command=self.student_pannels,text="Sinh viên",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 240 | std_b1_1.place(x=220,y=250,width=180,height=40) 241 | 242 | # Detect Face button 2 243 | det_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\det1.jpg") 244 | det_img_btn=det_img_btn.resize((180,180),Image.ANTIALIAS) 245 | self.det_img1=ImageTk.PhotoImage(det_img_btn) 246 | 247 | det_b1 = Button(bg_img,command=self.face_rec,image=self.det_img1,cursor="hand2",) 248 | det_b1.place(x=450,y=100,width=180,height=180) 249 | 250 | det_b1_1 = Button(bg_img,command=self.face_rec,text="Nhận Diện",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 251 | det_b1_1.place(x=450,y=250,width=180,height=40) 252 | 253 | # Attendance System button 3 254 | att_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\att.jpg") 255 | att_img_btn=att_img_btn.resize((180,180),Image.ANTIALIAS) 256 | self.att_img1=ImageTk.PhotoImage(att_img_btn) 257 | 258 | att_b1 = Button(bg_img,command=self.attendance_pannel,image=self.att_img1,cursor="hand2",) 259 | att_b1.place(x=680,y=100,width=180,height=180) 260 | 261 | att_b1_1 = Button(bg_img,command=self.attendance_pannel,text="Điểm Danh",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 262 | att_b1_1.place(x=680,y=250,width=180,height=40) 263 | 264 | # Help Support button 4 265 | hlp_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\hlp.jpg") 266 | hlp_img_btn=hlp_img_btn.resize((180,180),Image.ANTIALIAS) 267 | self.hlp_img1=ImageTk.PhotoImage(hlp_img_btn) 268 | 269 | hlp_b1 = Button(bg_img,command=self.helpSupport,image=self.hlp_img1,cursor="hand2",) 270 | hlp_b1.place(x=910,y=100,width=180,height=180) 271 | 272 | hlp_b1_1 = Button(bg_img,command=self.helpSupport,text="Hỗ Trợ",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 273 | hlp_b1_1.place(x=910,y=250,width=180,height=40) 274 | # Top 4 buttons end....... 275 | # --------------------------------------------------------------------------------------------------------------------------- 276 | # Start below buttons......... 277 | # Start below buttons......... 278 | # Train button 5 279 | tra_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\tra1.jpg") 280 | tra_img_btn=tra_img_btn.resize((180,180),Image.ANTIALIAS) 281 | self.tra_img1=ImageTk.PhotoImage(tra_img_btn) 282 | 283 | tra_b1 = Button(bg_img,command=self.train_pannels,image=self.tra_img1,cursor="hand2",) 284 | tra_b1.place(x=220,y=300,width=180,height=180) 285 | 286 | tra_b1_1 = Button(bg_img,command=self.train_pannels,text="Tải Data",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 287 | tra_b1_1.place(x=220,y=450,width=180,height=40) 288 | 289 | # Photo button 6 290 | pho_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\qr1.png") 291 | pho_img_btn=pho_img_btn.resize((180,180),Image.ANTIALIAS) 292 | self.pho_img1=ImageTk.PhotoImage(pho_img_btn) 293 | 294 | pho_b1 = Button(bg_img,command=self.open_img,image=self.pho_img1,cursor="hand2",) 295 | pho_b1.place(x=450,y=300,width=180,height=180) 296 | 297 | pho_b1_1 = Button(bg_img,command=self.open_img,text="QR-Codes",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 298 | pho_b1_1.place(x=450,y=450,width=180,height=40) 299 | 300 | # Developers button 7 301 | dev_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\dev.jpg") 302 | dev_img_btn=dev_img_btn.resize((180,180),Image.ANTIALIAS) 303 | self.dev_img1=ImageTk.PhotoImage(dev_img_btn) 304 | 305 | dev_b1 = Button(bg_img,command=self.developr,image=self.dev_img1,cursor="hand2",) 306 | dev_b1.place(x=680,y=300,width=180,height=180) 307 | 308 | dev_b1_1 = Button(bg_img,command=self.developr,text="Developers",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 309 | dev_b1_1.place(x=680,y=450,width=180,height=40) 310 | 311 | # exit button 8 312 | exi_img_btn=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\exi.jpg") 313 | exi_img_btn=exi_img_btn.resize((180,180),Image.ANTIALIAS) 314 | self.exi_img1=ImageTk.PhotoImage(exi_img_btn) 315 | 316 | exi_b1 = Button(bg_img,command=self.Close,image=self.exi_img1,cursor="hand2",) 317 | exi_b1.place(x=910,y=300,width=180,height=180) 318 | 319 | exi_b1_1 = Button(bg_img,command=self.Close,text="Thoát",cursor="hand2",font=("tahoma",15,"bold"),bg="white",fg="navyblue") 320 | exi_b1_1.place(x=910,y=450,width=180,height=40) 321 | 322 | 323 | # ==================Funtion for Open Images Folder================== 324 | def open_img(self): 325 | os.startfile("data_img") 326 | # ==================Functions Buttons===================== 327 | def student_pannels(self): 328 | self.new_window=Toplevel(self.root) 329 | self.app=Student(self.new_window) 330 | 331 | def train_pannels(self): 332 | self.new_window=Toplevel(self.root) 333 | self.app=Train(self.new_window) 334 | 335 | def face_rec(self): 336 | self.new_window=Toplevel(self.root) 337 | self.app=Face_Recognition(self.new_window) 338 | 339 | def attendance_pannel(self): 340 | self.new_window=Toplevel(self.root) 341 | self.app=Attendance(self.new_window) 342 | 343 | def developr(self): 344 | self.new_window=Toplevel(self.root) 345 | self.app=Developer(self.new_window) 346 | 347 | def helpSupport(self): 348 | self.new_window=Toplevel(self.root) 349 | self.app=Helpsupport(self.new_window) 350 | 351 | def Close(self): 352 | root.destroy() 353 | def open_img(self): 354 | os.startfile("dataset") 355 | 356 | 357 | 358 | 359 | 360 | 361 | if __name__ == "__main__": 362 | root=Tk() 363 | app=Login(root) 364 | root.mainloop() -------------------------------------------------------------------------------- /attendance.py: -------------------------------------------------------------------------------- 1 | # import re 2 | import re 3 | from sys import path 4 | from tkinter import* 5 | from tkinter import ttk 6 | from PIL import Image,ImageTk 7 | import os 8 | import mysql.connector 9 | import cv2 10 | import numpy as np 11 | from tkinter import messagebox 12 | from time import strftime 13 | from datetime import datetime 14 | import csv 15 | from tkinter import filedialog 16 | 17 | #Global variable for importCsv Function 18 | mydata=[] 19 | class Attendance: 20 | 21 | def __init__(self,root): 22 | self.root=root 23 | self.root.geometry("1250x700+0+0") 24 | self.root.title("Quản Lý Điểm Danh") 25 | 26 | #-----------Variables------------------- 27 | self.var_id=StringVar() 28 | self.var_roll=StringVar() 29 | self.var_name=StringVar() 30 | self.var_dep=StringVar() 31 | self.var_time=StringVar() 32 | self.var_date=StringVar() 33 | self.var_attend=StringVar() 34 | 35 | # This part is image labels setting start 36 | # first header image 37 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 38 | img=img.resize((1250,120),Image.ANTIALIAS) 39 | self.photoimg=ImageTk.PhotoImage(img) 40 | 41 | # set image as lable 42 | f_lb1 = Label(self.root,image=self.photoimg) 43 | f_lb1.place(x=0,y=0,width=1250,height=120) 44 | 45 | # backgorund image 46 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 47 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 48 | self.photobg1=ImageTk.PhotoImage(bg1) 49 | 50 | # set image as lable 51 | bg_img = Label(self.root,image=self.photobg1) 52 | bg_img.place(x=0,y=130,width=1250,height=768) 53 | 54 | 55 | #title section 56 | title_lb1 = Label(bg_img,text="Quản Lý Điểm Danh",font=("verdana",30,"bold"),bg="white",fg="navyblue") 57 | title_lb1.place(x=0,y=0,width=1250,height=40) 58 | 59 | #========================Section Creating================================== 60 | 61 | # Creating Frame 62 | main_frame = Frame(bg_img,bd=2,bg="white") #bd mean border 63 | main_frame.place(x=0,y=40,width=1300,height=480) 64 | 65 | # Left Label Frame 66 | left_frame = LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Sinh Viên",font=("verdana",12,"bold"),fg="navyblue") 67 | left_frame.place(x=10,y=10,width=660,height=480) 68 | 69 | 70 | 71 | # ==================================Text boxes and Combo Boxes==================== 72 | 73 | #Student id 74 | studentId_label = Label(left_frame,text="ID:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 75 | studentId_label.grid(row=0,column=0,padx=5,pady=5,sticky=W) 76 | 77 | studentId_entry = ttk.Entry(left_frame,textvariable=self.var_id,width=15,font=("verdana",12,"bold")) 78 | studentId_entry.grid(row=0,column=1,padx=5,pady=5,sticky=W) 79 | 80 | #Student Roll 81 | student_roll_label = Label(left_frame,text="Roll.No:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 82 | student_roll_label.grid(row=0,column=2,padx=5,pady=5,sticky=W) 83 | 84 | student_roll_entry = ttk.Entry(left_frame,textvariable=self.var_roll,width=15,font=("verdana",12,"bold")) 85 | student_roll_entry.grid(row=0,column=3,padx=5,pady=5,sticky=W) 86 | 87 | #Studnet Name 88 | student_name_label = Label(left_frame,text="Tên:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 89 | student_name_label.grid(row=1,column=0,padx=5,pady=5,sticky=W) 90 | 91 | student_name_entry = ttk.Entry(left_frame,textvariable=self.var_name,width=15,font=("verdana",12,"bold")) 92 | student_name_entry.grid(row=1,column=1,padx=5,pady=5,sticky=W) 93 | 94 | #Department 95 | # dep_label = Label(left_frame,text="Department:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 96 | # dep_label.grid(row=1,column=2,padx=5,pady=5,sticky=W) 97 | 98 | # dep_entry = ttk.Entry(left_frame,textvariable=self.var_dep,width=15,font=("verdana",12,"bold")) 99 | # dep_entry.grid(row=1,column=3,padx=5,pady=5,sticky=W) 100 | 101 | #time 102 | time_label = Label(left_frame,text="Giờ:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 103 | time_label.grid(row=1,column=2,padx=5,pady=5,sticky=W) 104 | 105 | time_entry = ttk.Entry(left_frame,textvariable=self.var_time,width=15,font=("verdana",12,"bold")) 106 | time_entry.grid(row=1,column=3,padx=5,pady=5,sticky=W) 107 | 108 | #Date 109 | date_label = Label(left_frame,text="Ngày:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 110 | date_label.grid(row=2,column=0,padx=5,pady=5,sticky=W) 111 | 112 | date_entry = ttk.Entry(left_frame,textvariable=self.var_date,width=15,font=("verdana",12,"bold")) 113 | date_entry.grid(row=2,column=1,padx=5,pady=5,sticky=W) 114 | 115 | #Attendance 116 | student_attend_label = Label(left_frame,text="Trạng thái:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 117 | student_attend_label.grid(row=2,column=2,padx=5,pady=5,sticky=W) 118 | 119 | attend_combo=ttk.Combobox(left_frame,textvariable=self.var_attend,width=13,font=("verdana",12,"bold"),state="readonly") 120 | attend_combo["values"]=("Trạng thái","Có mặt","Vắng mặt") 121 | attend_combo.current(0) 122 | attend_combo.grid(row=2,column=3,padx=5,pady=5,sticky=W) 123 | 124 | # ===============================Table Sql Data View========================== 125 | table_frame = Frame(left_frame,bd=2,bg="white",relief=RIDGE) 126 | table_frame.place(x=10,y=100,width=635,height=310) 127 | 128 | #scroll bar 129 | scroll_x = ttk.Scrollbar(table_frame,orient=HORIZONTAL) 130 | scroll_y = ttk.Scrollbar(table_frame,orient=VERTICAL) 131 | 132 | #create table 133 | self.attendanceReport_left = ttk.Treeview(table_frame,column=("ID","Roll_No","Name","Time","Date","Attend"),xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set) 134 | 135 | scroll_x.pack(side=BOTTOM,fill=X) 136 | scroll_y.pack(side=RIGHT,fill=Y) 137 | scroll_x.config(command=self.attendanceReport_left.xview) 138 | scroll_y.config(command=self.attendanceReport_left.yview) 139 | 140 | self.attendanceReport_left.heading("ID",text="ID") 141 | self.attendanceReport_left.heading("Roll_No",text="Roll.No") 142 | self.attendanceReport_left.heading("Name",text="Tên") 143 | self.attendanceReport_left.heading("Time",text="Giờ") 144 | self.attendanceReport_left.heading("Date",text="Ngày") 145 | self.attendanceReport_left.heading("Attend",text="Trạng thái") 146 | self.attendanceReport_left["show"]="headings" 147 | 148 | 149 | # Set Width of Colums 150 | self.attendanceReport_left.column("ID",width=100) 151 | self.attendanceReport_left.column("Roll_No",width=100) 152 | self.attendanceReport_left.column("Name",width=100) 153 | self.attendanceReport_left.column("Time",width=100) 154 | self.attendanceReport_left.column("Date",width=100) 155 | self.attendanceReport_left.column("Attend",width=100) 156 | 157 | self.attendanceReport_left.pack(fill=BOTH,expand=1) 158 | self.attendanceReport_left.bind("",self.get_cursor_left) 159 | 160 | 161 | # =========================button section======================== 162 | 163 | #Button Frame 164 | btn_frame = Frame(left_frame,bd=2,bg="white",relief=RIDGE) 165 | btn_frame.place(x=10,y=390,width=635,height=60) 166 | 167 | #Improt button 168 | save_btn=Button(btn_frame,command=self.importCsv,text="Nhập CSV",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 169 | save_btn.grid(row=0,column=0,padx=6,pady=10,sticky=W) 170 | 171 | #Exprot button 172 | update_btn=Button(btn_frame,command=self.exportCsv,text="Xuất CSV",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 173 | update_btn.grid(row=0,column=1,padx=6,pady=8,sticky=W) 174 | 175 | #Update button 176 | del_btn=Button(btn_frame,command=self.action,text="Sửa",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 177 | del_btn.grid(row=0,column=2,padx=6,pady=10,sticky=W) 178 | 179 | #reset button 180 | reset_btn=Button(btn_frame,command=self.reset_data,text="Reset",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 181 | reset_btn.grid(row=0,column=3,padx=6,pady=10,sticky=W) 182 | 183 | 184 | 185 | # Right section======================================================= 186 | 187 | # Right Label Frame 188 | right_frame = LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Chi tiết",font=("verdana",12,"bold"),fg="navyblue") 189 | right_frame.place(x=680,y=10,width=660,height=480) 190 | 191 | 192 | # -----------------------------Table Frame------------------------------------------------- 193 | #Table Frame 194 | #Searching System in Right Label Frame 195 | table_frame = Frame(right_frame,bd=2,bg="white",relief=RIDGE) 196 | table_frame.place(x=10,y=70,width=580,height=360) 197 | 198 | #scroll bar 199 | scroll_x = ttk.Scrollbar(table_frame,orient=HORIZONTAL) 200 | scroll_y = ttk.Scrollbar(table_frame,orient=VERTICAL) 201 | 202 | #create table 203 | self.attendanceReport = ttk.Treeview(table_frame,column=("ID","Roll_No","Name","Time","Date","Attend"),xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set) 204 | 205 | scroll_x.pack(side=BOTTOM,fill=X) 206 | scroll_y.pack(side=RIGHT,fill=Y) 207 | scroll_x.config(command=self.attendanceReport.xview) 208 | scroll_y.config(command=self.attendanceReport.yview) 209 | 210 | self.attendanceReport.heading("ID",text="ID") 211 | self.attendanceReport.heading("Roll_No",text="Roll.No") 212 | self.attendanceReport.heading("Name",text="Tên") 213 | self.attendanceReport.heading("Time",text="Giờ") 214 | self.attendanceReport.heading("Date",text="Ngày") 215 | self.attendanceReport.heading("Attend",text="Trạng thái") 216 | self.attendanceReport["show"]="headings" 217 | 218 | 219 | # Set Width of Colums 220 | self.attendanceReport.column("ID",width=30) 221 | self.attendanceReport.column("Roll_No",width=70) 222 | self.attendanceReport.column("Name",width=100) 223 | self.attendanceReport.column("Time",width=75) 224 | self.attendanceReport.column("Date",width=80) 225 | self.attendanceReport.column("Attend",width=120) 226 | 227 | self.attendanceReport.pack(fill=BOTH,expand=1) 228 | self.attendanceReport.bind("",self.get_cursor_right) 229 | self.fetch_data() 230 | # =================================update for mysql button================ 231 | #Update button 232 | del_btn=Button(right_frame,command=self.update_data,text="Sửa",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 233 | del_btn.grid(row=0,column=1,padx=6,pady=10,sticky=W) 234 | #Update button 235 | del_btn=Button(right_frame,command=self.delete_data,text="Xóa",width=12,font=("verdana",12,"bold"),fg="white",bg="navyblue") 236 | del_btn.grid(row=0,column=2,padx=6,pady=10,sticky=W) 237 | # ===============================update function for mysql database================= 238 | def update_data(self): 239 | if self.var_id.get()=="" or self.var_roll.get=="" or self.var_name.get()=="" or self.var_time.get()=="" or self.var_date.get()=="" or self.var_attend.get()=="Status": 240 | messagebox.showerror("Error","Vui lòng điền vào tất cả các trường được yêu cầu!",parent=self.root) 241 | else: 242 | try: 243 | Update=messagebox.askyesno("Update","Bạn có muốn cập nhật điểm chuyên cần của sinh viên này không!",parent=self.root) 244 | if Update > 0: 245 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 246 | mycursor = conn.cursor() 247 | mycursor.execute("update stdattendance set std_id=%s,std_roll_no=%s,std_name=%s,std_time=%s,std_date=%s,std_attendance=%s where std_id=%s",( 248 | self.var_id.get(), 249 | self.var_roll.get(), 250 | self.var_name.get(), 251 | self.var_time.get(), 252 | self.var_date.get(), 253 | self.var_attend.get(), 254 | self.var_id.get() 255 | )) 256 | else: 257 | if not Update: 258 | return 259 | messagebox.showinfo("Success","Cập nhật thành công!",parent=self.root) 260 | conn.commit() 261 | self.fetch_data() 262 | conn.close() 263 | except Exception as es: 264 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 265 | # =============================Delete Attendance form my sql============================ 266 | def delete_data(self): 267 | if self.var_id.get()=="": 268 | messagebox.showerror("Error","Mã số sinh viên phải được yêu cầu!",parent=self.root) 269 | else: 270 | try: 271 | delete=messagebox.askyesno("Delete","Bạn có muốn xóa không?",parent=self.root) 272 | if delete>0: 273 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 274 | mycursor = conn.cursor() 275 | sql="delete from stdattendance where std_id=%s" 276 | val=(self.var_id.get(),) 277 | mycursor.execute(sql,val) 278 | else: 279 | if not delete: 280 | return 281 | 282 | conn.commit() 283 | self.fetch_data() 284 | conn.close() 285 | messagebox.showinfo("Delete","Xóa thành công!",parent=self.root) 286 | except Exception as es: 287 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 288 | # ===========================fatch data form mysql attendance=========== 289 | 290 | def fetch_data(self): 291 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 292 | mycursor = conn.cursor() 293 | 294 | mycursor.execute("select * from stdattendance") 295 | data=mycursor.fetchall() 296 | 297 | if len(data)!= 0: 298 | self.attendanceReport.delete(*self.attendanceReport.get_children()) 299 | for i in data: 300 | self.attendanceReport.insert("",END,values=i) 301 | conn.commit() 302 | conn.close() 303 | 304 | #============================Reset Data====================== 305 | def reset_data(self): 306 | self.var_id.set("") 307 | self.var_roll.set("") 308 | self.var_name.set("") 309 | self.var_time.set("") 310 | self.var_date.set("") 311 | self.var_attend.set("Status") 312 | 313 | # =========================Fetch Data Import data =============== 314 | 315 | def fetchData(self,rows): 316 | global mydata 317 | mydata = rows 318 | self.attendanceReport_left.delete(*self.attendanceReport_left.get_children()) 319 | for i in rows: 320 | self.attendanceReport_left.insert("",END,values=i) 321 | print(i) 322 | 323 | 324 | def importCsv(self): 325 | mydata.clear() 326 | fln=filedialog.askopenfilename(initialdir=os.getcwd(),title="Open CSV",filetypes=(("CSV File","*.csv"),("All File","*.*")),parent=self.root) 327 | with open(fln) as myfile: 328 | csvread=csv.reader(myfile,delimiter=",") 329 | for i in csvread: 330 | mydata.append(i) 331 | self.fetchData(mydata) 332 | 333 | 334 | #==================Experot CSV============= 335 | def exportCsv(self): 336 | try: 337 | if len(mydata)<1: 338 | messagebox.showerror("Error","No Data Found!",parent=self.root) 339 | return False 340 | fln=filedialog.asksaveasfilename(initialdir=os.getcwd(),title="Open CSV",filetypes=(("CSV File","*.csv"),("All File","*.*")),parent=self.root) 341 | with open(fln,mode="w",newline="") as myfile: 342 | exp_write=csv.writer(myfile,delimiter=",") 343 | for i in mydata: 344 | exp_write.writerow(i) 345 | messagebox.showinfo("Successfuly","Xuất dữ liệu thành công!") 346 | except Exception as es: 347 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 348 | 349 | #=============Cursur Function for CSV======================== 350 | 351 | def get_cursor_left(self,event=""): 352 | cursor_focus = self.attendanceReport_left.focus() 353 | content = self.attendanceReport_left.item(cursor_focus) 354 | data = content["values"] 355 | 356 | self.var_id.set(data[0]), 357 | self.var_roll.set(data[1]), 358 | self.var_name.set(data[2]), 359 | self.var_time.set(data[3]), 360 | self.var_date.set(data[4]), 361 | self.var_attend.set(data[5]) 362 | 363 | #=============Cursur Function for mysql======================== 364 | 365 | def get_cursor_right(self,event=""): 366 | cursor_focus = self.attendanceReport.focus() 367 | content = self.attendanceReport.item(cursor_focus) 368 | data = content["values"] 369 | 370 | self.var_id.set(data[0]), 371 | self.var_roll.set(data[1]), 372 | self.var_name.set(data[2]), 373 | self.var_time.set(data[3]), 374 | self.var_date.set(data[4]), 375 | self.var_attend.set(data[5]) 376 | #=========================================Update CSV============================ 377 | 378 | # export upadte 379 | def action(self): 380 | if self.var_id.get()=="" or self.var_roll.get=="" or self.var_name.get()=="" or self.var_time.get()=="" or self.var_date.get()=="" or self.var_attend.get()=="Status": 381 | messagebox.showerror("Error","Vui lòng điền vào tất cả các trường là bắt buộc!",parent=self.root) 382 | else: 383 | try: 384 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 385 | mycursor = conn.cursor() 386 | mycursor.execute("insert into stdattendance values(%s,%s,%s,%s,%s,%s)",( 387 | self.var_id.get(), 388 | self.var_roll.get(), 389 | self.var_name.get(), 390 | self.var_time.get(), 391 | self.var_date.get(), 392 | self.var_attend.get() 393 | )) 394 | 395 | conn.commit() 396 | self.fetch_data() 397 | conn.close() 398 | messagebox.showinfo("Success","Tất cả các bản ghi được lưu trong cơ sở dữ liệu!",parent=self.root) 399 | except Exception as es: 400 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 401 | 402 | 403 | 404 | 405 | 406 | 407 | # conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 408 | # mycursor = conn.cursor() 409 | # if messagebox.askyesno("Confirmation","Are you sure you want to save attendance on database?"): 410 | # for i in mydata: 411 | # uid = i[0] 412 | # uroll = i[1] 413 | # uname = i[2] 414 | # utime = i[3] 415 | # udate = i[4] 416 | # uattend = i[5] 417 | # qury = "INSERT INTO stdattendance(std_id, std_roll_no, std_name, std_time, std_date, std_attendance) VALUES(%s,%s,%s,%s,%s,%s)" 418 | # mycursor.execute(qury,(uid,uroll,uname,utime,udate,uattend)) 419 | # conn.commit() 420 | # conn.close() 421 | # messagebox.showinfo("Success","Successfully Updated!",parent=self.root) 422 | # else: 423 | # return False 424 | 425 | 426 | 427 | 428 | # 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | if __name__ == "__main__": 439 | root=Tk() 440 | obj=Attendance(root) 441 | root.mainloop() -------------------------------------------------------------------------------- /student.py: -------------------------------------------------------------------------------- 1 | from tkinter import* 2 | from tkinter import ttk 3 | from PIL import Image,ImageTk 4 | from tkinter import messagebox 5 | import mysql.connector 6 | import cv2 7 | # Testing Connection 8 | """ 9 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 10 | cursor = conn.cursor() 11 | 12 | cursor.execute("show databases") 13 | 14 | data = cursor.fetchall() 15 | 16 | print(data) 17 | 18 | conn.close() 19 | """ 20 | class Student: 21 | def __init__(self,root): 22 | self.root=root 23 | self.root.geometry("1250x700+0+0") 24 | self.root.title("Hệ thống quản lý điểm danh sử dụng nhận dạng khuôn mặt") 25 | 26 | #-----------Variables------------------- 27 | self.var_dep=StringVar() 28 | self.var_course=StringVar() 29 | self.var_year=StringVar() 30 | self.var_semester=StringVar() 31 | self.var_std_id=StringVar() 32 | self.var_std_name=StringVar() 33 | self.var_div=StringVar() 34 | self.var_roll=StringVar() 35 | self.var_gender=StringVar() 36 | self.var_dob=StringVar() 37 | self.var_email=StringVar() 38 | self.var_mob=StringVar() 39 | self.var_address=StringVar() 40 | self.var_teacher=StringVar() 41 | 42 | # This part is image labels setting start 43 | # first header image 44 | img=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\banner.jpg") 45 | img=img.resize((1250,120),Image.ANTIALIAS) 46 | self.photoimg=ImageTk.PhotoImage(img) 47 | 48 | # set image as lable 49 | f_lb1 = Label(self.root,image=self.photoimg) 50 | f_lb1.place(x=0,y=0,width=1250,height=120) 51 | 52 | # backgorund image 53 | bg1=Image.open(r"D:\VKU\STEM\Python-FYP-Face-Recognition-Attendence-System\Images_GUI\bg3.jpg") 54 | bg1=bg1.resize((1250,768),Image.ANTIALIAS) 55 | self.photobg1=ImageTk.PhotoImage(bg1) 56 | 57 | # set image as lable 58 | bg_img = Label(self.root,image=self.photobg1) 59 | bg_img.place(x=0,y=130,width=1250,height=768) 60 | 61 | 62 | #title section 63 | title_lb1 = Label(bg_img,text="Trang Quản Lý Thông Tin Sinh Viên",font=("verdana",25,"bold"),bg="white",fg="navyblue") 64 | title_lb1.place(x=0,y=0,width=1250,height=40) 65 | 66 | # Creating Frame 67 | main_frame = Frame(bg_img,bd=2,bg="white") #bd mean border 68 | main_frame.place(x=0,y=40,width=1250,height=510) 69 | 70 | # Left Label Frame 71 | left_frame = LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Thông tin",font=("verdana",12,"bold"),fg="navyblue") 72 | left_frame.place(x=10,y=10,width=660,height=480) 73 | 74 | # Current Course 75 | current_course_frame = LabelFrame(left_frame,bd=2,bg="white",relief=RIDGE,text="Khóa học hiện tại",font=("verdana",10,"bold"),fg="navyblue") 76 | current_course_frame.place(x=10,y=5,width=635,height=150) 77 | 78 | #label Department 79 | dep_label=Label(current_course_frame,text="Ngành",font=("verdana",12,"bold"),bg="white",fg="navyblue") 80 | dep_label.grid(row=0,column=0,padx=5,pady=15) 81 | 82 | #combo box 83 | dep_combo=ttk.Combobox(current_course_frame,textvariable=self.var_dep,width=15,font=("verdana",12,"bold"),state="readonly") 84 | dep_combo["values"]=("Chọn","Kỹ thuật phần mềm","An toàn thông tin","Quản trị kinh doanh","Thiết kế MT số") 85 | dep_combo.current(0) 86 | dep_combo.grid(row=0,column=1,padx=5,pady=15,sticky=W) 87 | 88 | # ----------------------------------------------------- 89 | 90 | #label Course 91 | cou_label=Label(current_course_frame,text="Môn",font=("verdana",12,"bold"),bg="white",fg="navyblue") 92 | cou_label.grid(row=0,column=2,padx=5,pady=15) 93 | 94 | #combo box 95 | cou_combo=ttk.Combobox(current_course_frame,textvariable=self.var_course,width=15,font=("verdana",12,"bold"),state="readonly") 96 | cou_combo["values"]=("Chọn","STEM","Đồ họa MT","Lập trình mạng","Linux","AI") 97 | cou_combo.current(0) 98 | cou_combo.grid(row=0,column=3,padx=5,pady=15,sticky=W) 99 | 100 | #------------------------------------------------------------- 101 | 102 | #label Year 103 | year_label=Label(current_course_frame,text="Năm",font=("verdana",12,"bold"),bg="white",fg="navyblue") 104 | year_label.grid(row=1,column=0,padx=5,sticky=W) 105 | 106 | #combo box 107 | year_combo=ttk.Combobox(current_course_frame,textvariable=self.var_year,width=15,font=("verdana",12,"bold"),state="readonly") 108 | year_combo["values"]=("Chọn","2020","2021","2022","2023","2024") 109 | year_combo.current(0) 110 | year_combo.grid(row=1,column=1,padx=5,pady=15,sticky=W) 111 | 112 | #----------------------------------------------------------------- 113 | 114 | #label Semester 115 | year_label=Label(current_course_frame,text="Học kì",font=("verdana",12,"bold"),bg="white",fg="navyblue") 116 | year_label.grid(row=1,column=2,padx=5,sticky=W) 117 | 118 | #combo box 119 | year_combo=ttk.Combobox(current_course_frame,textvariable=self.var_semester,width=15,font=("verdana",12,"bold"),state="readonly") 120 | year_combo["values"]=("Chọn","Học kì-1","Học kì-2") 121 | year_combo.current(0) 122 | year_combo.grid(row=1,column=3,padx=5,pady=15,sticky=W) 123 | 124 | #Class Student Information 125 | class_Student_frame = LabelFrame(left_frame,bd=2,bg="white",relief=RIDGE,text="Sơ lược",font=("verdana",12,"bold"),fg="navyblue") 126 | class_Student_frame.place(x=10,y=160,width=635,height=230) 127 | 128 | #Student id 129 | studentId_label = Label(class_Student_frame,text="ID:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 130 | studentId_label.grid(row=0,column=0,padx=5,pady=5,sticky=W) 131 | 132 | studentId_entry = ttk.Entry(class_Student_frame,textvariable=self.var_std_id,width=15,font=("verdana",12,"bold")) 133 | studentId_entry.grid(row=0,column=1,padx=5,pady=5,sticky=W) 134 | 135 | #Student name 136 | student_name_label = Label(class_Student_frame,text="Tên:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 137 | student_name_label.grid(row=0,column=2,padx=5,pady=5,sticky=W) 138 | 139 | student_name_entry = ttk.Entry(class_Student_frame,textvariable=self.var_std_name,width=15,font=("verdana",12,"bold")) 140 | student_name_entry.grid(row=0,column=3,padx=5,pady=5,sticky=W) 141 | 142 | #Class Didvision 143 | student_div_label = Label(class_Student_frame,text="Buổi học:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 144 | student_div_label.grid(row=1,column=0,padx=5,pady=5,sticky=W) 145 | 146 | div_combo=ttk.Combobox(class_Student_frame,textvariable=self.var_div,width=13,font=("verdana",12,"bold"),state="readonly") 147 | div_combo["values"]=("Sáng","Chiều") 148 | div_combo.current(0) 149 | div_combo.grid(row=1,column=1,padx=5,pady=5,sticky=W) 150 | 151 | #Roll No 152 | student_roll_label = Label(class_Student_frame,text="Roll-No:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 153 | student_roll_label.grid(row=1,column=2,padx=5,pady=5,sticky=W) 154 | 155 | student_roll_entry = ttk.Entry(class_Student_frame,textvariable=self.var_roll,width=15,font=("verdana",12,"bold")) 156 | student_roll_entry.grid(row=1,column=3,padx=5,pady=5,sticky=W) 157 | 158 | #Gender 159 | student_gender_label = Label(class_Student_frame,text="Giới tính:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 160 | student_gender_label.grid(row=2,column=0,padx=5,pady=5,sticky=W) 161 | 162 | #combo box 163 | gender_combo=ttk.Combobox(class_Student_frame,textvariable=self.var_gender,width=13,font=("verdana",12,"bold"),state="readonly") 164 | gender_combo["values"]=("Nam","Nữ","Khác") 165 | gender_combo.current(0) 166 | gender_combo.grid(row=2,column=1,padx=5,pady=5,sticky=W) 167 | 168 | #Date of Birth 169 | student_dob_label = Label(class_Student_frame,text="DOB:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 170 | student_dob_label.grid(row=2,column=2,padx=5,pady=5,sticky=W) 171 | 172 | student_dob_entry = ttk.Entry(class_Student_frame,textvariable=self.var_dob,width=15,font=("verdana",12,"bold")) 173 | student_dob_entry.grid(row=2,column=3,padx=5,pady=5,sticky=W) 174 | 175 | #Email 176 | student_email_label = Label(class_Student_frame,text="Email:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 177 | student_email_label.grid(row=3,column=0,padx=5,pady=5,sticky=W) 178 | 179 | student_email_entry = ttk.Entry(class_Student_frame,textvariable=self.var_email,width=15,font=("verdana",12,"bold")) 180 | student_email_entry.grid(row=3,column=1,padx=5,pady=5,sticky=W) 181 | 182 | #Phone Number 183 | student_mob_label = Label(class_Student_frame,text="Mobile:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 184 | student_mob_label.grid(row=3,column=2,padx=5,pady=5,sticky=W) 185 | 186 | student_mob_entry = ttk.Entry(class_Student_frame,textvariable=self.var_mob,width=15,font=("verdana",12,"bold")) 187 | student_mob_entry.grid(row=3,column=3,padx=5,pady=5,sticky=W) 188 | 189 | #Address 190 | student_address_label = Label(class_Student_frame,text="Địa chỉ:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 191 | student_address_label.grid(row=4,column=0,padx=5,pady=5,sticky=W) 192 | 193 | student_address_entry = ttk.Entry(class_Student_frame,textvariable=self.var_address,width=15,font=("verdana",12,"bold")) 194 | student_address_entry.grid(row=4,column=1,padx=5,pady=5,sticky=W) 195 | 196 | #Teacher Name 197 | student_tutor_label = Label(class_Student_frame,text="Giảng viên:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 198 | student_tutor_label.grid(row=4,column=2,padx=5,pady=5,sticky=W) 199 | 200 | student_tutor_entry = ttk.Entry(class_Student_frame,textvariable=self.var_teacher,width=15,font=("verdana",12,"bold")) 201 | student_tutor_entry.grid(row=4,column=3,padx=5,pady=5,sticky=W) 202 | 203 | #Radio Buttons 204 | self.var_radio1=StringVar() 205 | radiobtn1=ttk.Radiobutton(class_Student_frame,text="Chụp ảnh",variable=self.var_radio1,value="Yes") 206 | radiobtn1.grid(row=5,column=0,padx=5,pady=5,sticky=W) 207 | 208 | radiobtn1=ttk.Radiobutton(class_Student_frame,text="Không có ảnh",variable=self.var_radio1,value="No") 209 | radiobtn1.grid(row=5,column=1,padx=5,pady=5,sticky=W) 210 | 211 | #Button Frame 212 | btn_frame = Frame(left_frame,bd=2,bg="white",relief=RIDGE) 213 | btn_frame.place(x=10,y=390,width=635,height=60) 214 | 215 | #save button 216 | save_btn=Button(btn_frame,command=self.add_data,text="Lưu",width=7,font=("verdana",12,"bold"),fg="white",bg="navyblue") 217 | save_btn.grid(row=0,column=0,padx=5,pady=10,sticky=W) 218 | 219 | #update button 220 | update_btn=Button(btn_frame,command=self.update_data,text="Sửa",width=7,font=("verdana",12,"bold"),fg="white",bg="navyblue") 221 | update_btn.grid(row=0,column=1,padx=5,pady=8,sticky=W) 222 | 223 | #delete button 224 | del_btn=Button(btn_frame,command=self.delete_data,text="Xóa",width=7,font=("verdana",12,"bold"),fg="white",bg="navyblue") 225 | del_btn.grid(row=0,column=2,padx=5,pady=10,sticky=W) 226 | 227 | #reset button 228 | reset_btn=Button(btn_frame,command=self.reset_data,text="Reset",width=7,font=("verdana",12,"bold"),fg="white",bg="navyblue") 229 | reset_btn.grid(row=0,column=3,padx=5,pady=10,sticky=W) 230 | 231 | #take photo button 232 | take_photo_btn=Button(btn_frame,command=self.generate_dataset,text="Chụp Ảnh",width=9,font=("verdana",12,"bold"),fg="white",bg="navyblue") 233 | take_photo_btn.grid(row=0,column=4,padx=5,pady=10,sticky=W) 234 | 235 | #update photo button 236 | update_photo_btn=Button(btn_frame,text="Sửa Ảnh",width=9,font=("verdana",12,"bold"),fg="white",bg="navyblue") 237 | update_photo_btn.grid(row=0,column=5,padx=5,pady=10,sticky=W) 238 | 239 | 240 | 241 | 242 | 243 | #---------------------------------------------------------------------- 244 | # Right Label Frame 245 | right_frame = LabelFrame(main_frame,bd=2,bg="white",relief=RIDGE,text="Danh sách",font=("verdana",12,"bold"),fg="navyblue") 246 | right_frame.place(x=680,y=10,width=660,height=480) 247 | 248 | #Searching System in Right Label Frame 249 | search_frame = LabelFrame(right_frame,bd=2,bg="white",relief=RIDGE,text="Tìm kiếm",font=("verdana",12,"bold"),fg="navyblue") 250 | search_frame.place(x=10,y=5,width=635,height=80) 251 | 252 | #Phone Number 253 | search_label = Label(search_frame,text="Tìm:",font=("verdana",12,"bold"),fg="navyblue",bg="white") 254 | search_label.grid(row=0,column=0,padx=5,pady=5,sticky=W) 255 | self.var_searchTX=StringVar() 256 | #combo box 257 | search_combo=ttk.Combobox(search_frame,textvariable=self.var_searchTX,width=12,font=("verdana",12,"bold"),state="readonly") 258 | search_combo["values"]=("Chọn","Roll-No") 259 | search_combo.current(0) 260 | search_combo.grid(row=0,column=1,padx=5,pady=15,sticky=W) 261 | 262 | self.var_search=StringVar() 263 | search_entry = ttk.Entry(search_frame,textvariable=self.var_search,width=12,font=("verdana",12,"bold")) 264 | search_entry.grid(row=0,column=2,padx=5,pady=5,sticky=W) 265 | 266 | search_btn=Button(search_frame,command=self.search_data,text="Tìm kiếm",width=9,font=("verdana",12,"bold"),fg="white",bg="navyblue") 267 | search_btn.grid(row=0,column=3,padx=5,pady=10,sticky=W) 268 | 269 | """ showAll_btn=Button(search_frame,command=self.fetch_data,text="Tất cả",width=8,font=("verdana",12,"bold"),fg="white",bg="navyblue") 270 | showAll_btn.grid(row=0,column=4,padx=5,pady=10,sticky=W) """ 271 | 272 | # -----------------------------Table Frame------------------------------------------------- 273 | #Table Frame 274 | #Searching System in Right Label Frame 275 | table_frame = Frame(right_frame,bd=2,bg="white",relief=RIDGE) 276 | table_frame.place(x=10,y=90,width=635,height=360) 277 | 278 | #scroll bar 279 | scroll_x = ttk.Scrollbar(table_frame,orient=HORIZONTAL) 280 | scroll_y = ttk.Scrollbar(table_frame,orient=VERTICAL) 281 | 282 | #create table 283 | self.student_table = ttk.Treeview(table_frame,column=("ID","Name","Dep","Course","Year","Sem","Div","Gender","DOB","Mob-No","Address","Roll-No","Email","Teacher","Photo"),xscrollcommand=scroll_x.set,yscrollcommand=scroll_y.set) 284 | 285 | scroll_x.pack(side=BOTTOM,fill=X) 286 | scroll_y.pack(side=RIGHT,fill=Y) 287 | scroll_x.config(command=self.student_table.xview) 288 | scroll_y.config(command=self.student_table.yview) 289 | 290 | self.student_table.heading("ID",text="ID") 291 | self.student_table.heading("Name",text="Tên") 292 | self.student_table.heading("Dep",text="Ngành") 293 | self.student_table.heading("Course",text="Lớp") 294 | self.student_table.heading("Year",text="Năm") 295 | self.student_table.heading("Sem",text="Học kì") 296 | self.student_table.heading("Div",text="Buổi") 297 | self.student_table.heading("Gender",text="Giới tính") 298 | self.student_table.heading("DOB",text="DOB") 299 | self.student_table.heading("Mob-No",text="Mob-No") 300 | self.student_table.heading("Address",text="Địa chỉ") 301 | self.student_table.heading("Roll-No",text="Roll-No") 302 | self.student_table.heading("Email",text="Email") 303 | self.student_table.heading("Teacher",text="Giảng viên") 304 | self.student_table.heading("Photo",text="Ảnh") 305 | self.student_table["show"]="headings" 306 | 307 | 308 | # Set Width of Colums 309 | self.student_table.column("ID",width=20) 310 | self.student_table.column("Name",width=100) 311 | self.student_table.column("Dep",width=100) 312 | self.student_table.column("Course",width=100) 313 | self.student_table.column("Year",width=100) 314 | self.student_table.column("Sem",width=100) 315 | self.student_table.column("Div",width=100) 316 | self.student_table.column("Gender",width=100) 317 | self.student_table.column("DOB",width=100) 318 | self.student_table.column("Mob-No",width=100) 319 | self.student_table.column("Address",width=100) 320 | self.student_table.column("Roll-No",width=100) 321 | self.student_table.column("Email",width=100) 322 | self.student_table.column("Teacher",width=100) 323 | self.student_table.column("Photo",width=100) 324 | 325 | 326 | self.student_table.pack(fill=BOTH,expand=1) 327 | self.student_table.bind("",self.get_cursor) 328 | self.fetch_data() 329 | # ==================Function Decleration============================== 330 | def add_data(self): 331 | if self.var_dep.get()=="Select Department" or self.var_course.get=="Select Course" or self.var_year.get()=="Select Year" or self.var_semester.get()=="Select Semester" or self.var_std_id.get()=="" or self.var_std_name.get()=="" or self.var_div.get()=="" or self.var_roll.get()=="" or self.var_gender.get()=="" or self.var_dob.get()=="" or self.var_email.get()=="" or self.var_mob.get()=="" or self.var_address.get()=="" or self.var_teacher.get()=="": 332 | messagebox.showerror("Error","Vui lòng điền vào tất cả các trường là bắt buộc!",parent=self.root) 333 | else: 334 | try: 335 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 336 | mycursor = conn.cursor() 337 | mycursor.execute("insert into student values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",( 338 | self.var_std_id.get(), 339 | self.var_std_name.get(), 340 | self.var_dep.get(), 341 | self.var_course.get(), 342 | self.var_year.get(), 343 | self.var_semester.get(), 344 | self.var_div.get(), 345 | self.var_gender.get(), 346 | self.var_dob.get(), 347 | self.var_mob.get(), 348 | self.var_address.get(), 349 | self.var_roll.get(), 350 | self.var_email.get(), 351 | self.var_teacher.get(), 352 | self.var_radio1.get() 353 | )) 354 | 355 | conn.commit() 356 | self.fetch_data() 357 | conn.close() 358 | messagebox.showinfo("Success","Tất cả các bản ghi đã được lưu!",parent=self.root) 359 | except Exception as es: 360 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 361 | 362 | # ===========================Fetch data form database to table ================================ 363 | 364 | def fetch_data(self): 365 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 366 | mycursor = conn.cursor() 367 | 368 | mycursor.execute("select * from student") 369 | data=mycursor.fetchall() 370 | 371 | if len(data)!= 0: 372 | self.student_table.delete(*self.student_table.get_children()) 373 | for i in data: 374 | self.student_table.insert("",END,values=i) 375 | conn.commit() 376 | conn.close() 377 | 378 | #================================get cursor function======================= 379 | 380 | def get_cursor(self,event=""): 381 | cursor_focus = self.student_table.focus() 382 | content = self.student_table.item(cursor_focus) 383 | data = content["values"] 384 | 385 | self.var_std_id.set(data[0]), 386 | self.var_std_name.set(data[1]), 387 | self.var_dep.set(data[2]), 388 | self.var_course.set(data[3]), 389 | self.var_year.set(data[4]), 390 | self.var_semester.set(data[5]), 391 | self.var_div.set(data[6]), 392 | self.var_gender.set(data[7]), 393 | self.var_dob.set(data[8]), 394 | self.var_mob.set(data[9]), 395 | self.var_address.set(data[10]), 396 | self.var_roll.set(data[11]), 397 | self.var_email.set(data[12]), 398 | self.var_teacher.set(data[13]), 399 | self.var_radio1.set(data[14]) 400 | # ========================================Update Function========================== 401 | def update_data(self): 402 | if self.var_dep.get()=="Select Department" or self.var_course.get=="Select Course" or self.var_year.get()=="Select Year" or self.var_semester.get()=="Select Semester" or self.var_std_id.get()=="" or self.var_std_name.get()=="" or self.var_div.get()=="" or self.var_roll.get()=="" or self.var_gender.get()=="" or self.var_dob.get()=="" or self.var_email.get()=="" or self.var_mob.get()=="" or self.var_address.get()=="" or self.var_teacher.get()=="": 403 | messagebox.showerror("Error","Vui lòng điền vào tất cả các trường là bắt buộc!",parent=self.root) 404 | else: 405 | try: 406 | Update=messagebox.askyesno("Update","Bạn có muốn sửa lại không!",parent=self.root) 407 | if Update > 0: 408 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 409 | mycursor = conn.cursor() 410 | mycursor.execute("update student set Name=%s,Department=%s,Course=%s,Year=%s,Semester=%s,Division=%s,Gender=%s,DOB=%s,Mobile_No=%s,Address=%s,Roll_No=%s,Email=%s,Teacher_Name=%s,PhotoSample=%s where Student_ID=%s",( 411 | self.var_std_name.get(), 412 | self.var_dep.get(), 413 | self.var_course.get(), 414 | self.var_year.get(), 415 | self.var_semester.get(), 416 | self.var_div.get(), 417 | self.var_gender.get(), 418 | self.var_dob.get(), 419 | self.var_mob.get(), 420 | self.var_address.get(), 421 | self.var_roll.get(), 422 | self.var_email.get(), 423 | self.var_teacher.get(), 424 | self.var_radio1.get(), 425 | self.var_std_id.get() 426 | )) 427 | else: 428 | if not Update: 429 | return 430 | messagebox.showinfo("Success","Cập nhật thành công!",parent=self.root) 431 | conn.commit() 432 | self.fetch_data() 433 | conn.close() 434 | except Exception as es: 435 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 436 | 437 | #==============================Delete Function========================================= 438 | def delete_data(self): 439 | if self.var_std_id.get()=="": 440 | messagebox.showerror("Error","Student Id phải bắt buộc!",parent=self.root) 441 | else: 442 | try: 443 | delete=messagebox.askyesno("Delete","Bạn có muốn xóa không?",parent=self.root) 444 | if delete>0: 445 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 446 | mycursor = conn.cursor() 447 | sql="delete from student where Student_ID=%s" 448 | val=(self.var_std_id.get(),) 449 | mycursor.execute(sql,val) 450 | else: 451 | if not delete: 452 | return 453 | 454 | conn.commit() 455 | self.fetch_data() 456 | conn.close() 457 | messagebox.showinfo("Delete","Xóa Thành Công!",parent=self.root) 458 | except Exception as es: 459 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 460 | 461 | # Reset Function 462 | def reset_data(self): 463 | self.var_std_id.set(""), 464 | self.var_std_name.set(""), 465 | self.var_dep.set(""), 466 | self.var_course.set(""), 467 | self.var_year.set(""), 468 | self.var_semester.set(""), 469 | self.var_div.set(""), 470 | self.var_gender.set(""), 471 | self.var_dob.set(""), 472 | self.var_mob.set(""), 473 | self.var_address.set(""), 474 | self.var_roll.set(""), 475 | self.var_email.set(""), 476 | self.var_teacher.set(""), 477 | self.var_radio1.set("") 478 | 479 | # ===========================Search Data=================== 480 | def search_data(self): 481 | if self.var_search.get()=="" or self.var_searchTX.get()=="Select": 482 | messagebox.showerror("Error","Select Combo option and enter entry box",parent=self.root) 483 | else: 484 | try: 485 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 486 | my_cursor = conn.cursor() 487 | sql = "SELECT Student_ID,Name,Department,Course,Year,Semester,Division,Gender,DOB,Mobile_No,Address,Roll_No,Email,Teacher_Name,PhotoSample FROM student where Roll_No='" +str(self.var_search.get()) + "'" 488 | my_cursor.execute(sql) 489 | # my_cursor.execute("select * from student where Roll_No= " +str(self.var_search.get())+" "+str(self.var_searchTX.get())+"") 490 | rows=my_cursor.fetchall() 491 | if len(rows)!=0: 492 | self.student_table.delete(*self.student_table.get_children()) 493 | for i in rows: 494 | self.student_table.insert("",END,values=i) 495 | if rows==None: 496 | messagebox.showerror("Error","Data Not Found",parent=self.root) 497 | conn.commit() 498 | conn.close() 499 | except Exception as es: 500 | messagebox.showerror("Error",f"Due To :{str(es)}",parent=self.root) 501 | 502 | 503 | #=====================This part is related to Opencv Camera part======================= 504 | # ==================================Generate Data set take image========================= 505 | def generate_dataset(self): 506 | if self.var_dep.get()=="Select Department" or self.var_course.get=="Select Course" or self.var_year.get()=="Select Year" or self.var_semester.get()=="Select Semester" or self.var_std_id.get()=="" or self.var_std_name.get()=="" or self.var_div.get()=="" or self.var_roll.get()=="" or self.var_gender.get()=="" or self.var_dob.get()=="" or self.var_email.get()=="" or self.var_mob.get()=="" or self.var_address.get()=="" or self.var_teacher.get()=="": 507 | messagebox.showerror("Error","Vui lòng điền vào tất cả các trường là bắt buộc!",parent=self.root) 508 | else: 509 | try: 510 | 511 | conn = mysql.connector.connect(username='root', password='2912002',host='localhost',database='face_recognition',port=3306) 512 | mycursor = conn.cursor() 513 | mycursor.execute("select * from student") 514 | myreslut = mycursor.fetchall() 515 | id=0 516 | for x in myreslut: 517 | id+=1 518 | 519 | mycursor.execute("update student set Name=%s,Department=%s,Course=%s,Year=%s,Semester=%s,Division=%s,Gender=%s,DOB=%s,Mobile_No=%s,Address=%s,Roll_No=%s,Email=%s,Teacher_Name=%s,PhotoSample=%s where Student_ID=%s",( 520 | self.var_std_name.get(), 521 | self.var_dep.get(), 522 | self.var_course.get(), 523 | self.var_year.get(), 524 | self.var_semester.get(), 525 | self.var_div.get(), 526 | self.var_gender.get(), 527 | self.var_dob.get(), 528 | self.var_mob.get(), 529 | self.var_address.get(), 530 | self.var_roll.get(), 531 | self.var_email.get(), 532 | self.var_teacher.get(), 533 | self.var_radio1.get(), 534 | self.var_std_id.get()==id+1 535 | )) 536 | conn.commit() 537 | self.fetch_data() 538 | self.reset_data() 539 | conn.close() 540 | 541 | # ====================part of opencv======================= 542 | 543 | face_classifier = cv2.CascadeClassifier("haarcascade_frontalface_default.xml") 544 | 545 | def face_croped(img): 546 | # conver gary sacle 547 | gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) 548 | faces = face_classifier.detectMultiScale(gray,1.3,5) 549 | #Scaling factor 1.3 550 | # Minimum naber 5 551 | for (x,y,w,h) in faces: 552 | face_croped=img[y:y+h,x:x+w] 553 | return face_croped 554 | cap=cv2.VideoCapture(0) 555 | img_id=0 556 | while True: 557 | ret,my_frame=cap.read() 558 | if face_croped(my_frame) is not None: 559 | img_id+=1 560 | face=cv2.resize(face_croped(my_frame),(200,200)) 561 | face=cv2.cvtColor(face,cv2.COLOR_BGR2GRAY) 562 | file_path="data_img/stdudent."+str(id)+"."+str(img_id)+".jpg" 563 | cv2.imwrite(file_path,face) 564 | cv2.putText(face,str(img_id),(50,50),cv2.FONT_HERSHEY_COMPLEX,2,(0,255,0),2) 565 | cv2.imshow("Capture Images",face) 566 | 567 | if cv2.waitKey(1)==13 or int(img_id)==100: 568 | break 569 | cap.release() 570 | cv2.destroyAllWindows() 571 | messagebox.showinfo("Result","Đã hoàn tất tạo tập dữ liệu!",parent=self.root) 572 | except Exception as es: 573 | messagebox.showerror("Error",f"Due to: {str(es)}",parent=self.root) 574 | 575 | 576 | # main class object 577 | 578 | if __name__ == "__main__": 579 | root=Tk() 580 | obj=Student(root) 581 | root.mainloop() 582 | --------------------------------------------------------------------------------