How aryan2-7/smartattendance works
1. This repository is a C++17 desktop application for smart attendance, built around a Qt GUI with OpenCV-based facial recognition and SQLite persistence. The top-level structure suggests a single executable launched from src/main.cpp, with feature modules split by responsibility rather than by service.
2. The main functional boundaries are visible in src/registration, src/attendance, src/auth, src/records, src/export, and src/db. These map to the core user flows: registering a face, authenticating a user, marking attendance, viewing stored records, exporting data, and storing/retrieving records from the database.
3. The only substantive source file present in the tree is src/registration/FaceRegistration.cpp and its header, so face registration is the most clearly implemented subsystem in the current snapshot. The other module directories exist but appear to be placeholders, which is important if you are drawing the architecture: the repository is structured as a multi-module app, but the implementation is only partially populated.
4. The computer-vision boundary is driven by OpenCV. The resources/haarcascades/haarcascade_frontalface_default.xml file indicates Haar cascade face detection is used for locating faces, while the README states LBPH recognition from opencv_contrib is part of the stack. That implies a pipeline of camera frames → face detection → face recognition/training → stored model.
5. Model artifacts are separated from source code under resources/trained_models. This suggests recognition state is persisted as filesystem assets rather than embedded in the database, which creates a clear split: image/model data on disk, operational records in SQLite.
6. The database boundary is represented by src/db and the README’s SQLite dependency. In the intended architecture, SQLite likely stores user profiles, attendance events, and record metadata, while the face model files hold recognition features or trained classifiers. That means the system has two persistence paths: relational data in SQLite and ML artifacts in local resources.
7. Authentication appears to be a separate gate in src/auth, not just a UI concern. For an architecture diagram, it should sit before administrative features like records viewing or export, controlling access to attendance and maintenance functions.
8. Attendance marking in src/attendance is logically downstream from registration and authentication. The expected flow is: a registered face is recognized from a live camera feed, then the attendance module writes a presence event to the database. This is the primary operational path of the application.
9. Records and export are read-heavy subsystems. src/records is likely responsible for querying and presenting attendance history, while src/export takes those same records and produces a file-based output format for reporting or sharing. Both depend on the database rather than on the camera/vision pipeline.
10. The resources/icons folder and the Qt dependency indicate a conventional desktop UI with packaged assets. UI rendering is therefore a separate layer from business logic, with the Qt frontend orchestrating module calls and showing results, rather than the modules directly driving each other.
11. From an architecture perspective, the important integration points are:
• UI entrypoint in main.cpp
• OpenCV camera/vision pipeline in registration and attendance
• SQLite as system-of-record for attendance and users
• trained model files as local ML artifacts
• resource files for cascades and UI assets
12. In short, this is a layered desktop system: presentation/UI on top, feature modules in the middle, and two persistence backends underneath. The visible codebase is best diagrammed as a modular monolith with clear separations for registration, recognition, auth, records, export, and database access.
Main entry points: main.cpp App entry · db DB access · attendance Attendance · FaceRegistration.cpp Face reg
Components 12
Presentation
Qt desktop entry and packaged UI assets
Feature Modules
Attendance workflow and user-facing application logic
- Registration · Registers new faces and prepares recognition data.
src/registration - Face reg · Implemented face registration workflow built on OpenCV.
src/registration/FaceRegistration.cpp - Attendance · Marks attendance from recognized faces and live capture.
src/attendance - Auth · Handles access control for administrative application flows.
src/auth - Records · Queries and presents stored attendance history.
src/records - Export · Produces file-based reports from stored attendance records.
src/export
Persistence
Database and local model/storage backends
- DB access · Application data access boundary for users, attendance, and metadata.
src/db - SQLite · System-of-record for users, attendance events, and record metadata.
Vision Assets
Face detection and recognition resources
- Trained models · Persisted recognition models and classifier state on disk.
resources/trained_models - Haar cascade · Face detection cascade used to locate faces in camera frames.
resources/haarcascades/haarcascade_frontalface_default.xml
Connections 17
- App entry → Registration: opens · The app launches into the feature modules from the desktop entrypoint.
- App entry → Attendance: opens · Attendance workflow is started from the main application shell.
- App entry → Auth: opens · Authentication gates protected features in the UI.
- App entry → Records: opens · Users browse attendance history through the main UI.
- App entry → Export: opens · Reporting/export actions are initiated from the application shell.
- Registration → Face reg: implements · Face registration is the concrete implemented subsystem in the repository snapshot.
- Face reg → Haar cascade: detects faces · Uses the Haar cascade to find faces in captured frames.
- Face reg → Trained models: writes model · Stores trained recognition artifacts on disk.
- Attendance → Haar cascade: detects faces · Locates faces before recognition and attendance marking.
- Attendance → Trained models: recognizes · Compares live captures against persisted recognition state.
- Attendance → DB access: writes event · Stores attendance marks and related metadata.
- Auth → DB access: verifies access · Checks credentials or user state through the database boundary.
- Records → DB access: reads history · Queries attendance records for display.
- Export → Records: consumes · Exports are based on the records query/view layer.
- Export → DB access: reads history · Pulls stored attendance data for report generation.
- DB access → SQLite: persists to · The application stores operational data in SQLite.
- App entry → Icons: loads assets · The UI uses packaged icons and desktop resources.