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.9.tar.gz (16.9 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.9-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djhudpicam-0.1.9.tar.gz
  • Upload date:
  • Size: 16.9 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.9.tar.gz
Algorithm Hash digest
SHA256 6581ea8f37d5a02e2f2fc5d253a702aa13f0a187ea29fa11660edff39edecb3f
MD5 4d2ecc1e6267f089bd9dca8d83bc3106
BLAKE2b-256 b1bc2187690f1332a2de0cf0b93adf863d4fcc4c1e38909ee944aa910c3bb0bb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djhudpicam-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 19.6 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9bb8941fed6c2209181d94681edb4b8b768511b93f7dd6651a1e2a278d60eb8c
MD5 e82c387604a18590bdeff6bf92c5d045
BLAKE2b-256 357296184821577b0fe3890362e656fbbaaaf0a93b3ee405856e129a46e6af08

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