Skip to content

borj404/dimveil

Repository files navigation

DimVeil

Realtime glyph art webcam filter with virtual camera output for Linux.

Use it as an artistic effect or a privacy alternative to blur filters.

DimVeil demo

Features

  • Customizable colors: Preconfigured themes (Light, Matrix, Cyberpunk, Hacker) or manual RGB hex for person, scene, and background
  • Person segmentation: Realtime person/scene separation using MediaPipe (ONNX Runtime)
  • Multiple glyph sets: ASCII, Russian, Katakana, Thai
  • Adjustable detail: Variable scale to control character density (8×8 to 64×64 pixel blocks)
  • Preview: SDL2 window to monitor the output in realtime

Installation

Debian-based distros

./install.sh           # Standard install
./install.sh --force   # Redownload segmentation model

This automatically:

  • Installs dependencies (cmake, v4l2loopback, SDL2, etc)
  • Installs ONNX Runtime
  • Compiles and installs DimVeil
  • Downloads the MediaPipe Selfie segmentation model
  • Configures the virtual camera

Other distros

Dependencies

Install packages:

  • Arch: sudo pacman -S base-devel cmake pkgconf wget sdl2 linux-headers v4l2loopback-dkms
  • Fedora: sudo dnf install gcc make cmake pkgconf wget SDL2-devel v4l2loopback akmod-v4l2loopback kernel-devel-$(uname -r)
  • openSUSE: sudo zypper install gcc make cmake pkgconf wget sdl2-compat-devel v4l2loopback-kmp-default

ONNX Runtime (optional, for segmentation)

Download from the official releases (tested with v1.24.3):

wget https://github.com/microsoft/onnxruntime/releases/download/v1.24.3/onnxruntime-linux-x64-1.24.3.tgz
tar -xzf onnxruntime-linux-x64-1.24.3.tgz
sudo cp -P onnxruntime-linux-x64-1.24.3/lib/libonnxruntime.so* /usr/local/lib/
sudo mkdir -p /usr/local/include/onnxruntime
sudo cp onnxruntime-linux-x64-1.24.3/include/*.h /usr/local/include/onnxruntime/
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/local.conf
sudo ldconfig

For aarch64, replace x64 with aarch64 in the commands above.

Segmentation model (optional)

TMP_DIR=$(mktemp -d)
wget -q -O "$TMP_DIR/resources.tar.gz" https://s3.ap-northeast-2.wasabisys.com/pinto-model-zoo/109_Selfie_Segmentation/resources.tar.gz
tar -xzf "$TMP_DIR/resources.tar.gz" -C "$TMP_DIR"
sudo mkdir -p /usr/local/share/dimveil
ONNX=$(find "$TMP_DIR" -type f -name '*Nx3x256x256*.onnx' 2>/dev/null | head -1)
[ -z "$ONNX" ] && ONNX=$(find "$TMP_DIR" -type f -name '*.onnx' 2>/dev/null | head -1)
sudo cp "$ONNX" /usr/local/share/dimveil/selfie_segmenter.onnx
rm -rf "$TMP_DIR"

Build

With segmentation (requires ONNX Runtime):

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_SEGMENTATION=ON ..
make -j$(nproc)
sudo make install

Without segmentation:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install

Virtual camera

# Fedora only: build the kernel module if not already compiled
sudo akmods --force
sudo modprobe -r v4l2loopback 2>/dev/null || true
sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="Virtual Cam" exclusive_caps=1

To load on boot:

echo "options v4l2loopback devices=1 video_nr=10 card_label=\"Virtual Cam\" exclusive_caps=1" | sudo tee /etc/modprobe.d/dimveil.conf
echo "v4l2loopback" | sudo tee /etc/modules-load.d/dimveil.conf

Options

Input:
  -e, --enumerate         Enumerate available cameras
  [device]                Input device (default: autodetect)

Output:
  -o, --output DEVICE     Virtual camera (default: /dev/video10)
  -s, --scale N           Block scale 1-4: 8x8, 16x16, 32x32, 64x64 (default: 1)
  -l, --less-resolution   Use 8x8 glyphs (default: 16x16)
  -g, --glyph-table N     Glyph table: 0|ascii, 1|russian, 2|katakana, 3|thai (default: ascii)
  -F, --font FILE         Custom font file (default: per glyph table)
  -i, --invert            Invert brightness mapping (recommended for low light environments)
  -t, --theme N           Color theme: 0|default, 1|light, 2|matrix, 3|cyberpunk, 4|hacker
  -c, --color RRGGBB      Foreground color (default: DEDEDE)
  -b, --bg-color RRGGBB   Background color (default: 0F0F0F)

Segmentation:
  -S, --segment           Enable person segmentation (MediaPipe Selfie)
  --scene RRGGBB          Scene color (default: 999999)
  --interval N            Frames between inference (default: 1)

Display:
  -p, --preview           Show SDL2 preview window
  -f, --fps               Print FPS counter
  -q, --quiet             Suppress verbose output
  -h, --help              Show help

Examples

# Default (white on black) and preview window
dimveil -p

# FPS display and red glyphs
dimveil -p -f -c FF0000

# Katakana glyphs with light theme
dimveil -p -g katakana -t 1

# Segmentation with custom scene color
dimveil -p -S --scene 0000FF

# Theme with foreground (person with segmentation enabled) color override
dimveil -p -S -t cyberpunk -c 00FF00

# Less frequent segmentation (lower CPU usage)
dimveil -p -S --interval 3

Color themes

Option Foreground (Person) Background Scene
-t 0 or -t default #DEDEDE #0F0F0F #999999
-t 1 or -t light #000000 #DEDEDE #999999
-t 2 or -t matrix #DEDEDE #006300 #00DE00
-t 3 or -t cyberpunk #00DEFF #0F0F0F #DE00DE
-t 4 or -t hacker #DE0000 #0F0F0F #00BB00

theme-0 theme-1 theme-2 theme-3 theme-4

Individual color flags (-c, -b, --scene) override theme colors.

Glyph tables

Option Name Default Font
-g 0 or -g ascii ASCII FreeSans
-g 1 or -g russian Russian Georgia
-g 2 or -g katakana Katakana M PLUS 1 Code
-g 3 or -g thai Thai Umpush

Each table contains 64 characters ordered by visual density for the associated font.

To create custom glyph tables for other fonts, feel free to use densort.

Data flow

  1. Capture - V4L2 grabs frames from the webcam
  2. Convert - Frames become grayscale (plus RGB when segmentation is enabled)
  3. Segment - ONNX Runtime infers a person mask (optional)
  4. Render - Grayscale block averages map to glyph characters (Y plane)
  5. Color - UV planes apply foreground/background colors (person vs scene with segmentation)
  6. Output - YUV420 frame writes to the v4l2loopback virtual camera
  7. Preview - SDL2 window displays the output (optional)

Uninstall

sudo rm /usr/local/bin/dimveil*
sudo rm -rf /usr/local/share/dimveil
sudo rm /etc/modprobe.d/dimveil.conf /etc/modules-load.d/dimveil.conf
sudo modprobe -r v4l2loopback 2>/dev/null || true

If ONNX Runtime was installed manually:

sudo rm /usr/local/lib/libonnxruntime.so*
sudo rm -rf /usr/local/include/onnxruntime
sudo rm -f /etc/ld.so.conf.d/local.conf
sudo ldconfig

If ONNX Runtime was installed via apt:

sudo apt remove libonnxruntime-dev

System dependencies (v4l2loopback, SDL2...) are left installed.

License

Copyright 2026 borj404 - Apache-2.0

Releases

No releases published

Packages

 
 
 

Contributors