Skip to content

Refactored Architecture

Inbasekaran Perumal edited this page Aug 11, 2024 · 2 revisions
classDiagram
    class VisionGuardApp {
        +main() : void
    }

    %% Core Components
    class VisionGuard {
        +processFrame(cv::Mat frame)
    }
    class GazeDetectionEngine {
        +detectGaze(cv::Mat frame)
    }
    class EyeGazeTimeTracker {
        +trackTime(cv::Mat frame)
    }
    class BreakNotificationSystem {
        +notifyBreak()
    }
    class PerformanceTracker {
        +trackPerformance(cv::Mat frame)
    }
    class VectorCalibration {
        +calibrate(cv::Mat frame)
    }
    class DeviceManager {
        +switchDevice(std::string device)
    }
    class CameraManager {
        +switchCamera(int cameraIndex)
    }
    class ModelManager {
        +loadModel(std::string precision)
    }
    class Logging {
        +logInfo(std::string message)
        +logError(std::string message)
    }
    class ErrorHandling {
        +handleError(std::string errorType)
    }

    %% UI Components
    class MainWindow {
        +show()
    }
    class UIManager {
        +updateUI()
        +onGazeTimeExceeded()
    }

    %% Utility Functions
    class Utils {
    }

    %% Third Party
    class ThirdParty {
    }

    %% Relationships
    VisionGuardApp --> VisionGuard : "Uses"
    VisionGuardApp --> MainWindow : "Displays"

    VisionGuard --> GazeDetectionEngine
    VisionGuard --> EyeGazeTimeTracker
    VisionGuard --> BreakNotificationSystem
    VisionGuard --> PerformanceTracker
    VisionGuard --> VectorCalibration
    VisionGuard --> DeviceManager
    VisionGuard --> CameraManager
    VisionGuard --> ModelManager
    VisionGuard --> Logging
    VisionGuard --> ErrorHandling

    MainWindow --> UIManager : "Handles"
    UIManager --> VisionGuard : "Interacts with"

    VisionGuard --> Utils : "Uses"
    VisionGuard --> ThirdParty: "Uses"
Loading

Project structure:

/visionguard_app/
│
├── /src/                     # Source code files
│   ├── camera_manager.cpp
│   ├── device_manager.cpp
│   ├── model_manager.cpp
│   ├── configuration_manager.cpp
│   ├── chart_factory.cpp
│   ├── error_handling.cpp
│   ├── logging.cpp
│   ├── vision_guard.cpp
│   ├── gaze_detection_engine.cpp
│   ├── eye_gaze_time_tracker.cpp
│   ├── break_notification_system.cpp
│   ├── performance_tracker.cpp
│   ├── vector_calibration.cpp
│   ├── ui_manager.cpp
│   ├── mainwindow.cpp
│   ├── utils.cpp
│   └── main.cpp               # Main entry point of the application
│
├── /include/                 # Header files
│   ├── camera_manager.hpp
│   ├── device_manager.hpp
│   ├── model_manager.hpp
│   ├── configuration_manager.hpp
│   ├── chart_factory.hpp
│   ├── error_handling.hpp
│   ├── logging.hpp
│   ├── vision_guard.hpp
│   ├── gaze_detection_engine.hpp
│   ├── eye_gaze_time_tracker.hpp
│   ├── break_notification_system.hpp
│   ├── performance_tracker.hpp
│   ├── vector_calibration.hpp
│   ├── ui_manager.hpp
│   ├── mainwindow.h
│   ├── utils.hpp
│   └── config.hpp             # Configuration constants and settings
│
├── /resources/               # UI resources and assets
│   ├── assets/               # Place the icons and other static resources here
│   └── mainwindow.ui         # UI file for the main window layout
│
├── /third_party/             # Third-party libraries and headers
│   ├── lib1/
│   ├── lib2/
│   └── include/

Explanation

  • /src/ Directory:

    • Contains all the source code files, both core logic and UI-related code. This keeps everything together, making it easier to navigate.
  • /include/ Directory:

    • Holds all the header files, corresponding directly to the .cpp files in the src/ directory.
  • /resources/ Directory:

    • Contains UI resources like icons, images, and .ui files.
  • /third_party/ Directory:

    • Contains any third-party libraries.