Curated collection of Python exercises on classical computer vision (CV) and real-time data processing, designed with a focus on building robust, maintainable code and adhering to clean software engineering practices.
Originally developed for personal interview preparation and portfolio use, these exercises may also be useful for other engineers or technical reviewers evaluating practical CV and software engineering skills in Python.
- Real-Time Data Processing: Working with live data streams using techniques such as moving averages and staged processing pipelines.
- Classical Computer Vision: Implementing core CV algorithms like pose angle calculation, motion detection, and contour analysis.
- Clean Coding and Best Practices: Writing maintainable code that reflects solid engineering discipline.
- Robustness: Designing systems that gracefully handle edge cases, runtime errors, and unpredictable input data.
This repository contains the following exercises:
- Moving Average Smoother for Real-Time Sensor Data: Implement a moving average smoother to filter noisy sensor data.
- Pose Angle Calculator from Keypoints: Calculate angles between specific body parts from pose keypoints detected in images or video.
- Motion Detection in Video: Detect and track motion in video streams, useful for security and monitoring applications.
- Contour Analysis: Detect and analyze contours in images to extract and process shapes.
- Real-Time Pipeline Skeleton: Implement a pipeline that processes video frames through multiple stages such as data source, processing, and output.
- Exception Handling and Logging: Implement robust error handling and logging to ensure smooth operation and track issues.
- Bonus: Hand Raise Detection: Detect if a person raises their hand above shoulder level based on pose keypoints.
- Linux operating system (tested on Ubuntu 24.04)
- Python 3.10+ (recommended version: 3.12)
- Required Python packages listed in
requirements.txt
To set up the environment:
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtWhen finished, deactivate the environment with deactivate.
Note: the .venv folder is approximately 1 GB (due to MediaPipe); you can safely delete it when no longer needed.
Each exercise can be executed individually. Below are the commands to run each script:
Apply a moving average smoother on real-time sensor data:
python package/smoother.pyCalculate angles between keypoints from pose detection:
python package/pose_angle_calculator.pyRun the motion detection system on webcam input:
python package/motion_detector.pyExample result:
Analyze contours in an image:
python package/contour_analysis.pyProcess video frames through a pipeline:
python package/pipeline.pySee the exception handling and logging in action:
python package/pipeline_with_logging.pyDetect if a person raises their hand based on pose landmarks:
python package/hand_raise_detection.pyExample result:
To run the tests that validate the functionality of each component:
python -m unittest discover testsMIT.

