Skip to content

Latest commit

 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

image

A live camera feed, rendered as edge-detected braille art, straight in your terminal. mirror-bash grabs frames from your webcam, runs Sobel edge detection on each one with OpenCV, and maps the result onto a brightness-sorted Braille Unicode ramp turning your terminal into an

Requirements

  • CMake 3.16+
  • A C++20 compiler (tested with AppleClang/Clang on macOS)
  • OpenCV (4.x recommended), discoverable via find_package(OpenCV)
  • A webcam
  • A real terminal emulator (not a piped/non-interactive shell) — the live view uses raw terminal input and the alternate screen buffer

macOS install of OpenCV via Homebrew:

brew install opencv

Building

git clone <this-repo-url>
cd mirror-bash
cmake -B build
cmake --build build

This produces the mirror-bash executable inside build/.

Usage

Run it from an interactive terminal:

./build/mirror-bash
  • On first run, macOS will prompt for camera access for your terminal app — allow it, or mirror-bash won't be able to open the camera.
  • A banner is shown while the camera warms up, then live frames take over.
  • Press q or Esc to quit at any time.
  • The app also auto-exits after 5 seconds as a hard runtime cap.
  • On exit, the camera and capture thread are shut down and your terminal is restored to its normal state (cursor and scrollback included).

How it works

  • CameraCapture opens the webcam and runs a background thread that continuously grabs and resizes frames.
  • FrameBuffer is a thread-safe single-slot hand-off between the capture thread and the render loop, so the main thread always renders the latest available frame.
  • FrameRenderer runs Sobel edge detection on each frame, then maps the gradient magnitude onto a ramp of Braille Unicode glyphs sorted by dot count (sparse dots = dark/flat areas, dense dots = strong edges).
  • TerminalGuard puts the terminal into raw input mode and the alternate screen buffer for the duration of the run, restoring everything on exit.

Troubleshooting

  • "ERROR! Unable to open camera" — another app may be holding the camera, or camera permission wasn't granted to your terminal. Check System Settings → Privacy & Security → Camera.
  • Nothing but the banner shows — the camera is taking a while to warm up; it should switch to live frames once the first one arrives, or the app will time out after 5 seconds.
  • Garbled characters instead of braille art — make sure your terminal's locale/encoding is UTF-8 (most modern terminals are by default).

About

A real-time terminal application that captures webcam input and renders it as animated braille art using C++ and OpenCV.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages