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.6.tar.gz (23.7 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.6-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djhudpicam-0.1.6.tar.gz
  • Upload date:
  • Size: 23.7 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.6.tar.gz
Algorithm Hash digest
SHA256 b4f5a190060e336f152dc77066694629ab992458aeee65548c2eac441a2758d8
MD5 ea6aaf3fabf493538b526c902efc4428
BLAKE2b-256 7247e4729073515e6e4b5036380adcac426c663c86d2f5f1bbe24ca5ff4545f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djhudpicam-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 27.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c6b0dbc1adaf36cb829dc16b588c0ecc20deddc4db909f8419d16b96feb6f4e2
MD5 641d5f43239741571c63ff7d6082605b
BLAKE2b-256 7f96ce63a08a652a04cf8ed371703f7d0207e0d8a47d904e257aef53d144705f

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