How dominickdemilio/smart-room-cam works
Project type and purpose
• This is a lightweight full-stack Python application for a Raspberry Pi.
• Purpose: Acquire live video from a Pi camera, run motion detection and object recognition, and stream to a web browser via Flask.
File structure
• Top-level:
• main.py – application entry point that starts the Flask server and ties together modules
• app/ – core Python modules
– camera_stream.py: captures frames from the Pi camera and exposes them as a video feed
– motion_detector.py: processes frames and flags motion events
– recognizer.py: runs an AI model (OpenCV or pretrained) to detect humans or faces
• static/ – client-side assets (style.css)
• templates/ – HTML templates (index.html) used by Flask to render the UI
• tests/ – unit tests for camera module
Key insights from README
• Built with Python, OpenCV, Flask
• Features: live streaming, modular AI processing (motion detection, recognition)
• Future plans: Dockerization, authentication
Main components and their relationships
a. Hardware layer
– Raspberry Pi with attached camera module
b. Processing layer (inside Pi)
• CameraStream component: pulls raw frames from hardware
• MotionDetector component: analyzes frames for movement
• Recognizer component: runs AI inference on frames
c. Application layer
• Flask Web Server (main.py)
– Routes:
/ → serves index.html
/video_feed → streams MJPEG from camera_stream.py
– Injects motion status or recognition results into the stream or separate endpoints
d. Presentation layer
– Browser client requesting HTML, CSS, and MJPEG stream over HTTP
e. (Future) Deployment layer
– Docker container wrapping the above
– Optional external auth service if exposing remotely
Architectural patterns and design principles
• Modular design: each processing step is isolated in its own Python module
• Pipeline pattern: camera → motion detector → recognizer → stream
• Single-process, multi-modular architecture – simplicity over microservices for a Pi
• Clear separation of concerns: acquisition, processing, web serving, presentation