Skip to content

hyphestusrobotics/raspberrypi_people_detection

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Raspberry Pi People Detection

Overview

This project utilizes a Raspberry Pi to detect people in real-time using a camera. It leverages OpenCV's HOG (Histogram of Oriented Gradients) object detection and MQTT for message publishing. The system detects people in the camera frame and sends the number of detected people to a specified MQTT broker.

Features

  • Real-time people detection using a webcam (Not a pyCam) connected to Raspberry Pi via USB.
  • MQTT-based communication to publish the count of detected people.
  • Adjustable camera and broker parameters such as index, resolution, and broker configuration via command-line arguments.
  • Timestamp logging with ANSI color formatting for better visualization in the terminal.
  • .deb package creation for easy installation on Raspberry Pi devices.

Requirements

To run this project, you need:

  • Rust: This project is built using the Rust programming language. Ensure you have Rust version 1.82.0 or later installed.

    To install Rust, follow these steps:

    1. Install rustup by running:
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    1. Once rustup is installed, you can check the Rust version by running:
    rustc --version
    1. If you need to switch to version 1.82.0 (the required version), you can install it using:
    rustup install 1.82.0
    rustup default 1.82.0
  • Dependencies: The exact dependencies required for this project will be listed here once identified. However, you may need the following to get started:

    • opencv: OpenCV bindings for Rust.
    • rumqttc: MQTT client for communication.

    You can add dependencies by including them in the Cargo.toml file. Example:

    [dependencies]
    opencv = "0.72"
    rumqttc = "0.13"
    tokio = { version = "1", features = ["full"] }
    chrono = "0.4"

Installation

  1. Clone the repository:

    git clone https://github.com/xartokoptiko/raspberrypi_people_detection.git
    cd raspberry-pi-people-detection
  2. Install the necessary dependencies:

    cargo build --release
  3. Create a .deb package:

    ./package-debian.sh

    This will generate a .deb package in the linux/ directory, which can be installed on a Raspberry Pi with:

    sudo dpkg -i raspberrypi_people_detection_1.0.0-1_amd64.deb
  4. Run the program:

    raspberrypi_people_detection [camera_index] [frame_width] [frame_height] [broker_ip] [broker_port]

    Replace the placeholders with the appropriate values. If no arguments are provided, the program will use default values:

    • camera_index: 2
    • frame_width: 1280
    • frame_height: 720
    • broker_ip: 192.168.1.55
    • broker_port: 1883

License

This project is licensed under the Apache License 2.0.

About

Real-time people detection on Raspberry Pi using OpenCV and MQTT. ๐Ÿš€

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 86.1%
  • Shell 13.9%