# gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1 architecture

> Architecture diagram of the GitHub repository gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1
- Repository: https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1

## Overview

##### Main Components
- Evaluation Modules – Found under the “evaluacion” directory. Here you see:
- “clasificadores” (various Haar cascades and LBP detectors)
- “src” (C++ source code for different detectors such as detector_final.cpp, detector_hog.cpp, etc.)
- “matlab” – scripts for additional evaluation, image analysis (e.g., histograma.m)
- “scripts” – shell scripts that coordinate running various evaluation executables and possibly batch processing sets of images.
- “resultados” – folders with CSV/ODS/text outputs, showing test runs over different datasets (set1, set235nuevo, mejores235, etc.)
- ROS Implementation – Under “implementacion” there is a ROS workspace (with catkin_make configuration) containing the “detpeople” package. This package includes:
- ROS node(s) that subscribe (and, in one case, publish video) on topics such as “/camera/image”
- Files like ImageConverter.cpp (used to convert image messages to OpenCV format), as well as various detector implementations (DetectorCascada, DetectorHog, etc.)
- Peripheral / Calibration Data – The “otros” directory contains calibration files for the TurtleBot’s cameras, and an external raspi node zip file for the Raspicam.
- Documentation – PDFs such as “Guía_de_uso.pdf” and the project “informe_Aguado_Emder.pdf” serve as background/support documents.

##### Relationships and Data Flow
- ROS Communication: Two key ROS nodes exist:
- The “publicador_video” node (in implementacion package) that publishes live image feeds.
- The “detpeople” detector node that subscribes to input topics, applies detection algorithms (which internally may use one or several classifiers such as Haar cascades or HOG detectors), and publishes detection results.
– Note the customization indicated in ImageConverter.cpp (you may switch between input sources).
- Evaluation Pipeline: In parallel to the live detection:
- The “evaluacion” components (compiled executables in evaluacion/ejecutables and source code in evaluacion/src) run offline experiments on different datasets (with results stored in evaluacion/resultados).
- Matlab scripts process images (see evaluacion/matlab) and help generate histograms or other analyses.
- External Dependencies: OpenCV (for processing, detection, image manipulation) and ROS Indigo (for node communication).

##### Architectural Patterns and Design Principles
- Modularity: The obvious separation between evaluation and online modules allows iterative testing without impacting the live system.
- ROS Pub/Sub Design: Making use of topics to decouple the image source and processing.
- Reusability: Several detectors are implemented in different ways (e.g., “detector_final”, “detector_hog”, “detector_dummy”) which suggests an architecture that can easily swap algorithms.
- Scripted Orchestration: Shell scripts in evaluacion/scripts organize and automate evaluation experiments.
- Separation of Concerns: The project differentiates between testing (offline evaluation, result generation) and operational modules (online detection with ROS).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Sensor Input Layer
    subgraph "Camera/Sensor Inputs"
        Kinect("Kinect Camera"):::sensor
        Webcam("Webcam"):::sensor
        Raspi("Raspberry Pi Camera"):::sensor
    end

    %% ROS Communication Layer
    subgraph "ROS Communication"
        PubVid("publicador_video Node"):::rosnode
        Detpeople("detpeople Node (ImageConverter & Detectors)"):::rosnode
        ROSBuild("ROS Build System"):::build
    end

    %% Evaluation Pipeline (Offline)
    subgraph "Evaluation Pipeline"
        EvalClassifiers("Evaluation Classifiers"):::evaluation
        EvalCPP("Evaluation C++ Detectors"):::evaluation
        MatlabEval("Matlab Scripts"):::evaluation
        ShellScripts("Shell Scripts"):::evaluation
        EvalResults("Evaluation Results Repository"):::data
    end

    %% External Dependencies & Calibration
    subgraph "External Tools & Peripheral Data"
        OpenCV("OpenCV Library"):::external
        ROSIndigo("ROS Indigo"):::external
        Calibration("Camera Calibration & Raspi Node"):::external
    end

    %% Documentation Group
    subgraph "Documentation"
        Guia("Guía_de_uso.pdf"):::doc
        Informe("informe_Aguado_Emder.pdf"):::doc
    end

    %% Data Flow Connections
    %% Sensors to ROS Publisher Node
    Kinect -->|"publish_image"| PubVid
    Webcam -->|"publish_image"| PubVid
    Raspi -->|"publish_image"| PubVid

    %% ROS Communication within Nodes
    PubVid -->|"publishes_video"| Detpeople
    Detpeople -->|"subscribes_/camera/image"| PubVid
    Detpeople -->|"built_by_catkin_make"| ROSBuild

    %% Evaluation Pipeline Relations
    EvalClassifiers -->|"used_by"| EvalCPP
    ShellScripts -->|"orchestrates"| EvalCPP
    EvalCPP -->|"produces"| EvalResults
    MatlabEval -->|"analyzes"| EvalResults

    %% External Dependencies Relations
    Calibration -->|"calibrates"| Raspi
    OpenCV -->|"processes"| Detpeople
    ROSIndigo -->|"runs"| PubVid
    ROSIndigo -->|"runs"| Detpeople

    %% Documentation Influence (informational links)
    Guia -.->|"provides_info"| PubVid
    Informe -.->|"details_system"| Detpeople

    %% Click Events
    click EvalClassifiers "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/evaluacion/clasificadores"
    click EvalCPP "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/evaluacion/src"
    click MatlabEval "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/evaluacion/matlab"
    click ShellScripts "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/evaluacion/scripts"
    click EvalResults "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/evaluacion/resultados"
    click Detpeople "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/implementacion/src/detpeople"
    click Calibration "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/tree/master/otros"
    click Guia "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/blob/master/Guía_de_uso.pdf"
    click Informe "https://github.com/gerunsj/deteccion-de-personas-con-turtlebot-y-opencv-1/blob/master/informe_Aguado_Emder.pdf"

    %% Styles
    classDef sensor fill:#A7D8DE,stroke:#333,stroke-width:2px;
    classDef rosnode fill:#F8B195,stroke:#333,stroke-width:2px;
    classDef evaluation fill:#C06C84,stroke:#333,stroke-width:2px;
    classDef data fill:#355C7D,stroke:#333,stroke-width:2px;
    classDef external fill:#99B898,stroke:#333,stroke-width:2px;
    classDef doc fill:#D3B88C,stroke:#333,stroke-width:2px;
    classDef build fill:#F67280,stroke:#333,stroke-width:2px;
```
