A live computer-vision viewer built with Python 3, OpenCV, and Tkinter β powered by your phone camera via scrcpy + v4l2loopback.
Phone (USB/ADB) β scrcpy v4l2-sink β /dev/video0 β OpenCV β Tkinter canvas
| Toggle | Detection |
|---|---|
| π€ Face | Blue bounding box + "Face" label |
| π Eye | Amber boxes inside detected faces |
| π Smile | Yellow highlight on smiles |
| π€ Hand | OpenCV skin contour + convexity defects + finger count bar |
| π§ Body | Purple boxes (full + upper body) |
| β‘ Edge | Canny edge overlay (teal tint) |
- FPS counter displayed at top-left
- Finger counting via convexity defects β YCrCb skin segmentation + contour analysis
- Smart camera scan β only checks existing
/dev/video*devices - Dark theme β Catppuccin Mocha inspired, glassmorphism aesthetic
# Arch / pacman
sudo pacman -S python-opencv python-pillow python-numpy v4l2loopback-dkms
# scrcpy (phone camera pipe)
sudo pacman -S scrcpy android-tools
# Load v4l2loopback
sudo modprobe v4l2loopback| Package | Why |
|---|---|
| OpenCV | Face/Haar, YCrCb skin mask, contour detection, all CV |
| tkinter | Built-in GUI |
| pillow | Frame β Tkinter canvas |
β οΈ No external ML libraries needed β hand detection uses pure OpenCV (YCrCb colour-space skin segmentation + convexity-defect finger counting).
You also need v4l2loopback-dkms built for your kernel (pacman handles this).
1. Add yourself to the video group (one-time):
sudo usermod -a -G video $USER
# Then log out and back in2. Start the phone camera stream (keep this terminal open):
scrcpy --v4l2-sink=/dev/video0 --video-source=camera \
--camera-id=0 --camera-size=1920x1080 \
--camera-fps=30 --no-window3. Launch the app (new terminal):
python3 camera_assistant.pySelect Camera 0 from the dropdown β click βΆ Start.
Toggle individual detections on/off while the stream is live.
| Action | Button |
|---|---|
| βΆ Start / β Stop | Bottom-left |
| π Rescan | Re-scan camera devices |
| Face / Eye / Smile / Hand / Body / Edge | Checkboxes β toggle live |
- Built for Nothing A142P (Android 16) but works with any phone camera accessible via ADB.
- The
v4l2loopbackkernel module creates a virtual video device that scrcpy writes to. - Hand detection uses skin-colour HSV masking + convexity defects for finger counting.