Skip to content

stephanballer/light_frame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LightFrame

Overview

LightFrame is a cross-platform utility to capture the screen and adjust an LED strip's colors accordingly. It supports various platforms including Linux (both X11 and Wayland), macOS, and Windows. The utility reads the screen, calculates the average color of different screen segments, and sends this data over a serial connection to control an LED strip behind an ESP32 that runs light_frame_receiver.

Features

  • Supports X11 and Wayland on Linux
  • Supports macOS and Windows
  • Configurable number of LEDs and other parameters
  • Serial communication to send color data
  • Automatically starts on device connection using udev rules (Linux)

  • CMake 3.10 or higher
  • OpenCV
  • X11 libraries (for X11 support)
  • Grim (for Wayland support)

Installation

Linux (Ubuntu/Debian-based distributions)

sudo apt update
sudo apt install cmake libopencv-dev grim # For Wayland
sudo apt install cmake libopencv-dev libx11-dev # For X11

Arch Linux

sudo pacman -S cmake opencv grim # For Wayland
sudo pacman -S cmake opencv xorg-server-devel # For X11

macOS

brew install cmake opencv

Windows

Building the Project

  1. Clone the Repository:

    git clone https://github.com/stephanballer/light_frame.git
    cd light_frame
  2. Create a Build Directory:

    mkdir build
    cd build
  3. Run CMake:

    For X11 support:

    cmake -DUSE_X11=ON ..

    For Wayland support:

    cmake -DUSE_WAYLAND=ON ..
  4. Build the Project:

    make
  5. Install the Project:

    sudo make install
  6. Reload udev Rules (if on Linux):

    sudo udevadm control --reload-rules
    sudo udevadm trigger
    sudo systemctl daemon-reload

Usage

Linux

The program will automatically run when a device matching the udev rule is connected. If you need to run it manually:

backlight_capture /dev/ttyUSBX

Replace /dev/ttyUSBX with the appropriate serial device.

Configuration

You can configure the number of LEDs and other parameters via the config file:

  • Linux: /etc/backlightcapture/config.txt
  • Macos: /Library/Application Support/BacklightCapture/config.txt
  • Windows: C:\ProgramData\BacklightCapture\config.txt

or via command-line arguments. For example:

backlight_capture /dev/ttyUSBX -H 21 -aH 1 -V 9 -aV 0 -t 32 -s 4 -b 0.2 -f 60
  • -H, --horizontal-leds: Number of horizontal LEDs
  • -aH, --add-horizontal: Add virtual LEDs left and right
  • -V, --vertical-leds: Number of vertical LEDs
  • -aV, --add-vertical: Add virtual LEDs top and bottom
  • -t, --border-thickness: Border thickness while calculating average color
  • -s, --skip-pixels: Number of pixels to skip while calculating average color
  • -b, --brightness: LED brightness
  • -f, --max-fps: Maximum frames per second

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published