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
- 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 opencvgit clone <this-repo-url>
cd mirror-bash
cmake -B build
cmake --build buildThis produces the mirror-bash executable inside build/.
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-bashwon't be able to open the camera. - A banner is shown while the camera warms up, then live frames take over.
- Press
qorEscto 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).
CameraCaptureopens the webcam and runs a background thread that continuously grabs and resizes frames.FrameBufferis 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.FrameRendererruns 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).TerminalGuardputs the terminal into raw input mode and the alternate screen buffer for the duration of the run, restoring everything on exit.
- "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).