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.7.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.7-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djhudpicam-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 1bb618219429af2fdacc2adcb5893711b886b7eef584a37cdb02cf23305c01e4
MD5 9259bb4c9e3302c843aa5f6b696a8660
BLAKE2b-256 f069513d5a6f411e0478decc3c7eef7facc5a3fde5962c729268b145d08512b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djhudpicam-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 27.5 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc2fc62ab1b5882a74d0b2706549f54419fa9bb9cc1bec06f64eb507802263b
MD5 07720a90cbb5332748efac5324f55494
BLAKE2b-256 1006bcd2daef53f0b0f866fa892adfa0f13c9901691dc2efbf59be89d4bcb1fb

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