MapleCam
A smart breathing monitor for my dog Maple using computer vision and signal processing.

How It Works: The Algorithm
When I leave my dog Maple alone, I want to ensure he is resting safely. Instead of buying a specialized pet monitor, I developed a Python-based computer vision application that connects directly to my existing Amcrest security camera's RTSP stream and extracts bio-signals in real-time.
- ROI Extraction: The system isolates a Region of Interest (ROI) over Maple's chest and abdomen. Since dogs sleep in various positions, the ROI can be dynamically rotated and cropped to accurately frame his body.
- Movement Detection: The ROI is converted to grayscale, and the algorithm calculates the absolute pixel difference between consecutive frames. The mean of this difference generates a continuous "raw movement" signal.
- Signal Processing & Peak Detection: Raw pixel differences are noisy. The system applies thresholding and enforces a minimum time window (4 seconds) between peaks to accurately distinguish a true breathing cycle from random twitches or camera noise.
- Live Telemetry & Graphing: Using Matplotlib rendered directly into OpenCV matrices, the app overlays real-time telemetry alongside the video feed. This includes the live movement wave, a real-time BPM (Breaths Per Minute) rolling average, and a historical BPM trend over time.
System Demo
Below are exported clips from the monitor's development. While the final polished interface (shown at the top of the page) features a rich dark-theme dashboard with multiple telemetry graphs, these videos showcase the core algorithm in action. You can see the camera feed with the isolated Region of Interest alongside the real-time movement and frequency plots reacting dynamically to Maple's breathing.