{"id":23919485,"url":"https://github.com/dotpipe/motion-detection","last_synced_at":"2026-02-12T08:35:02.241Z","repository":{"id":270654207,"uuid":"911050459","full_name":"dotpipe/motion-detection","owner":"dotpipe","description":"AI Vision with minimal pictures and easily created labels.","archived":false,"fork":false,"pushed_at":"2025-01-02T06:28:36.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T07:22:16.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotpipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T06:08:37.000Z","updated_at":"2025-01-02T06:28:40.000Z","dependencies_parsed_at":"2025-01-02T07:22:19.952Z","dependency_job_id":"f5f86f57-daab-4636-87e5-ed882b7a7189","html_url":"https://github.com/dotpipe/motion-detection","commit_stats":null,"previous_names":["dotpipe/motion-detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpipe%2Fmotion-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpipe%2Fmotion-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpipe%2Fmotion-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpipe%2Fmotion-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotpipe","download_url":"https://codeload.github.com/dotpipe/motion-detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240378927,"owners_count":19792040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-05T14:52:38.700Z","updated_at":"2026-02-12T08:34:57.222Z","avatar_url":"https://github.com/dotpipe.png","language":"Python","readme":"# **Motion Detection and Object Tracking System**\n\n[![Working](https://img.shields.io/badge/Status-Working-brightgreen)](https://github.com/your-repository)  \n[![Python](https://img.shields.io/badge/Python-3.8%2B-blue)](https://www.python.org/downloads/)  \n[![OpenCV](https://img.shields.io/badge/OpenCV-4.5%2B-yellowgreen)](https://opencv.org/)  \n[![License](https://img.shields.io/badge/License-MIT-lightgrey)](LICENSE)\n\nThis project is a **real-time motion detection and object tracking system** that captures moving objects, processes frames dynamically, and identifies unique objects with minimal human intervention. It uses **OpenCV**, **background subtraction**, and **image similarity metrics (SSIM)** to track objects across frames and classify them as new or existing objects. The system is designed to work efficiently in real-time, with a focus on automation and accuracy.\n\n---\n# Advanced Real-Time Object Detection and Tracking System\n\n## Overview\nThis system provides a sophisticated approach to real-time object detection, tracking, and classification using computer vision techniques. It stands out for its dynamic object persistence and intelligent merging capabilities.\n\n## Key Components\n\n### 1. Background Subtraction and Motion Detection\n- Uses `cv2.createBackgroundSubtractorMOG2` for robust motion detection\n- Implements adaptive history tracking (500 frames) with optimized shadow removal\n- Features dynamic threshold adjustment for varying lighting conditions\n\n### 2. Intelligent Object Merging\nThe system employs a unique three-tier merging strategy:\n- **Color-based Merging**: Analyzes mean color values with configurable tolerance\n- **Spatial Proximity**: Merges objects based on dynamic distance thresholds\n- **Motion Coherence**: Groups objects with similar movement patterns\n\n### 3. Object Persistence and Recognition\n- Maintains a database of detected objects in `CROPPED_DIR`\n- Uses Structural Similarity Index (SSIM) for robust object matching\n- Implements duplicate detection and cleanup via `dupes.py`\n\n### 4. Real-time Processing Pipeline\n1. Frame capture and preprocessing\n2. Background subtraction\n3. Contour detection and filtering\n4. Dynamic object merging\n5. Object recognition and tracking\n6. Visual feedback with bounding boxes and labels\n\n## Key Advantages\n\n### Enhanced Accuracy\n- Multi-factor object detection reduces false positives\n- Dynamic threshold adaptation for varying environments\n- Intelligent merging prevents object fragmentation\n\n### Efficient Processing\n- Optimized contour operations\n- Selective frame resizing for performance\n- Smart caching of object data\n\n### Robust Object Recognition\n- SSIM-based matching for reliable object identification\n- Persistence across frame sequences\n- Automatic duplicate management\n\n## Files Structure\n\n### live3.py\n- Main implementation with full feature set\n- Handles object tracking, recognition, and persistence\n- Implements the complete processing pipeline\n\n### real.py\n- Lightweight version focusing on core detection\n- Useful for testing and development\n- Contains basic merging algorithms\n\n### dupes.py\n- Manages duplicate object detection\n- Maintains database consistency\n- Optimizes storage usage\n\n## Technical Specifications\n- Minimum object size: 500 pixels\n- Color tolerance: 30 units (RGB space)\n- Distance threshold: 50 pixels\n- SSIM threshold: 0.14\n- Frame resolution: 640x480 (configurable)\n\n## Advantages Over Traditional Systems\n1. **Dynamic Object Handling**\n   - Traditional systems often use fixed thresholds\n   - This system adapts to changing conditions\n\n2. **Intelligent Merging**\n   - Most systems treat objects independently\n   - Our approach considers spatial and color relationships\n\n3. **Persistent Recognition**\n   - Common systems only track frame-to-frame\n   - This implementation maintains object identity across sessions\n\n4. **Resource Efficiency**\n   - Optimized processing pipeline\n   - Selective update mechanisms\n   - Smart caching strategies\n\n## Use Cases\n- Security monitoring\n- Object counting and tracking\n- Motion analysis\n- Behavioral pattern recognition\n- Industrial quality control\n\n## Future Improvements\n1. Deep learning integration for enhanced recognition\n2. Multi-camera support\n3. Real-time performance optimization\n4. Extended object classification capabilities\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotpipe%2Fmotion-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotpipe%2Fmotion-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotpipe%2Fmotion-detection/lists"}