Skip to main content

DJ HUD headless/Pi camera source node for the DJ HUD collective

Project description

djhud-pi

Pi Zero 2 W camera source node for the DJ HUD collective.

Points a Pi Camera at a screen (laptop, CDJ display, mixer) and streams cropped / perspective-corrected regions to the main DJ HUD app over the WireGuard VPN — or directly to VDO.Ninja / a virtual camera device.


Architecture

Pi Camera (picamera2)
    │
    ▼
CameraCapture  ──►  RegionSet (per-region perspective de-warp via OpenCV)
                         │
                         ▼
                   HUD Strip (numpy composite, 1280×100)
                         │
              ┌──────────┼──────────┐
              ▼          ▼          ▼
         VPN WebSocket  VDO.Ninja  Virtual Cam
         (aiohttp)      (aiortc)   (pyvirtualcam)
              │
              ▼
        Main DJ HUD app
        (StreamClient receiver — ws://10.66.66.x:8765/stream)

Install

# On a Pi Zero 2 W with Raspberry Pi OS (Bookworm)
pip install djhud-pi

# With Pi Camera support
pip install "djhud-pi[pi]"

# Everything
pip install "djhud-pi[all]"

System dependencies (Pi)

sudo apt install python3-tk python3-opencv libatlas-base-dev
sudo apt install python3-picamera2   # or: pip install picamera2
# For virtual camera output:
sudo modprobe v4l2loopback

Run

djhudpi
# or
python -m djhudpi

Workflow

  1. Start Camera — select resolution & FPS, click ▶ Start Camera
  2. Add Regions — click + Add, name your region
  3. Place crop — click in the preview to set crop origin, edit W/H in Edit dialog
  4. Perspective correction — select a region, click 📐 Pick Warp Corners, then click the 4 corners of the screen/display in the preview (TL→TR→BR→BL). Drag dots to fine-tune. Click Apply.
  5. Enable output — tick VPN WebSocket Stream, enter your VPN port. The stream URL (e.g. ws://10.66.66.3:8765/stream) appears — paste it into the main DJ HUD app's StreamClient source field.
  6. Config auto-saves on close to ~/.djhudpi_config.json.

Perspective de-warp

When pointing the Pi Camera at a screen at an angle, use Pick Warp Corners to click the 4 corners of the screen content area. djhud-pi computes a homography (cv2.findHomography) and cv2.warpPerspective to produce a flat, front-on crop regardless of camera angle.


Outputs

Output Protocol Notes
VPN WebSocket JPEG over WS (aiohttp) Matches main DJ HUD StreamClient
VDO.Ninja WebRTC (aiortc) Stub — port vdoninja_client.py from main app
Virtual Camera v4l2loopback + pyvirtualcam Use as webcam source in OBS/browser

File structure

src/djhudpi/
├── __init__.py       version
├── __main__.py       entry point
├── app.py            tkinter GUI
├── camera.py         picamera2 / OpenCV capture
├── region.py         Region model + perspective warp + composite
├── warp_picker.py    4-corner picker dialog
└── output.py         VPN stream / VDO.Ninja / virtual cam backends

Development / testing on non-Pi hardware

Falls back to OpenCV VideoCapture automatically when picamera2 is not available, so you can develop and test on your Mac or Windows machine with a regular webcam.

pip install "djhud-pi"   # no [pi] extra needed on non-Pi
djhudpi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djhudpicam-0.1.1.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djhudpicam-0.1.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file djhudpicam-0.1.1.tar.gz.

File metadata

  • Download URL: djhudpicam-0.1.1.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for djhudpicam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b1924a67b3d9533348ee94b6c30aaf69738d59efe5e77627fc1fac55f3611858
MD5 510d69aca5f4c1f23b6dab19f878bcd3
BLAKE2b-256 c337523f0a9024de882675729d9d8d34df2e37a718e03155daf3c11663356eac

See more details on using hashes here.

File details

Details for the file djhudpicam-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: djhudpicam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for djhudpicam-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bc0cefc2ee5402a4a3d7d11f64d7b54bd07feb749e8c417fb0c26a13c30436e
MD5 309dae87162edca2792b58c160731b10
BLAKE2b-256 dcc000d5468f6c35e7414a2bd42fa58c054ebe29821ddb3d5a9aad2e06cf8905

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page