# prsntmaurya/object-detection architecture

> Architecture diagram of the GitHub repository prsntmaurya/object-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prsntmaurya/object-detection
- Repository: https://github.com/prsntmaurya/object-detection

## Overview

##### Main Components
- Face Detection Module: Represents the functionality for detecting human faces and eyes using Haar cascade classifiers. This module includes loading the pre-trained XML files (haarcascade_frontalface_alt.xml, haarcascade_frontalface_default.xml, and haarcascade_eye_tree_eyeglasses.xml), building the cascade classifiers, detecting faces, then detecting eyes for each face.
- Jellyfish Detection Module: Represents the functionality for detecting jellyfish. It uses blob detection algorithms to find regions with a homogeneous intensity pattern and computes centroids as detection points.
- Input/Output Handling: Even though these are relatively simple one-off command-line utilities, show the flow of input images (like “oscarSelfie.jpg” or “jellyfish.jpg”) and corresponding output images (in the results directory) for each module.
- Underlying Libraries & Dependencies: Clearly indicate the use of C++ and OpenCV (version 3.0 and above). Optionally, show the role of pkg-config for handling compiler flags and linking.

##### Architectural Patterns & Design Principles
- Modularity: Even though the project’s code is simple and separated by problem (each in distinct C++ files inside Section1), show a clear separation of concerns where each detection problem is self-contained.
- Reusability: Indicate that both modules use OpenCV’s high-level functionalities (e.g., cascade classifiers, blob detection) and have a similar structure for processing input images.

##### Technologies, Frameworks, and Tools
- Mention the XML configuration files explicitly for the face detection component.

##### Detailed Elements
- A labeled component for “Face Detection” showing:
▪ Loading Haar Cascade XML files.
▪ Initializing and running classifier detection.
▪ Sub-step for eye detection within detected face regions.
- A labeled component for “Jellyfish Detection” showing:
▪ Setting blob detection parameters.
▪ Performing keypoint detection and centroid calculation.
- A shared “I/O” region where:
▪ Input images are provided.
▪ The processed output images are produced in the results folder.
- Connections with technology annotations (e.g., using OpenCV libraries for processing).

## Diagram (Mermaid)

```mermaid
flowchart TD
    P("Project"):::project
    IO("Image Input/Output"):::io
    CPP("C++"):::tech
    OP("OpenCV (>=3.0)"):::tech

    %% Project structure
    P --> IO

    %% Face Detection Module branch
    IO --> FD("Face Detection Module"):::module
    FD --> FD1("Load Pre-trained Haar Cascades"):::process
    FD1 --> FD2("Cascade Classifier"):::process
    FD2 --> FD3("Detect Face"):::process
    FD3 --> FD4("Detect Eyes"):::process
    FD4 --> FD5("Output Detected Faces"):::process

    %% Cascade XML configuration files under Cascade Classifier
    FD2 --> CF1("haarcascade_frontalface_alt.xml"):::config
    FD2 --> CF2("haarcascade_frontalface_default.xml"):::config
    FD2 --> CF3("haarcascade_eye_tree_eyeglasses.xml"):::config

    %% Jellyfish Detection Module branch
    IO --> JD("Jellyfish Detection Module"):::module
    JD --> JD1("Image Preprocessing"):::process
    JD1 --> JD2("Keypoint Detection"):::process
    JD2 --> JD3("Calculate Centroid"):::process
    JD3 --> JD4("Output Processed Image"):::process

    %% External Dependencies
    P --- CPP
    P --- OP
    FD -.-> OP
    JD -.-> OP

    %% Click Events
    click FD "https://github.com/prsntmaurya/object-detection/blob/master/Section1/face_detection.cpp"
    click CF1 "https://github.com/prsntmaurya/object-detection/blob/master/Section1/haarcascade_frontalface_alt.xml"
    click CF2 "https://github.com/prsntmaurya/object-detection/blob/master/Section1/haarcascade_frontalface_default.xml"
    click CF3 "https://github.com/prsntmaurya/object-detection/blob/master/Section1/haarcascade_eye_tree_eyeglasses.xml"
    click JD "https://github.com/prsntmaurya/object-detection/blob/master/Section1/jellyfish_detection/jellyfish_detection.cpp"
    click IO "https://github.com/prsntmaurya/object-detection/tree/master/results"

    %% Styles
    classDef project fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef io fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef module fill:#66ccff,stroke:#333,stroke-width:2px;
    classDef process fill:#ffffff,stroke:#333,stroke-width:2px;
    classDef config fill:#ff9999,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5;
    classDef tech fill:#cccccc,stroke:#333,stroke-width:2px,stroke-dasharray: 2,2;
```
