Giter Site home page Giter Site logo

miker2808 / multiprocessed-motiondetector-tracker Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24.94 MB

A Python OpenCV multiprocessed motion detector with an optional tracker

Python 100.00%
motion-detector tracker multiprocessing rois subtraction python

multiprocessed-motiondetector-tracker's Introduction

Multiprocessed motion detector & tracker

Multiprocessed Python OpenCV motion detector with an optional tracker.

requirements

Opencv >= 4.4.0.0 (recommended with 'pip3 install opencv-contrib-python')
numpy >= 1.18.0
python >= 3.6

Installation & Use

Clone the repository, checkout to desired branch (with tracker or without). open the 'multiprocessed-motiondetector-tracker.py'

# change the variable:
examplevideo = '' # to your video path, or otherwise an IP to your stream

simply run the script.

How does it work?

The algorithm runs on multiple layers, on top, it is multiprocessed using 3 processes. The first process, called CameraProcess, is a function responsible for handling the video buffer and sending the frames to the second process, called the AlgorithmProcess, it handles the motion detector and the tracker.

The motion detector uses the background subtraction algorithm for detection, therefore it's weakness is moving cameras. The motion detector scans sectors also know as 'blocks' from the subtracted images, like a "delta" image. if the scan senses motion, which is represented in the subtracted image output as white colored area, it appends it. Once the scan is complete, the algorithm connects the "blocks" using standard opencv method, which outputs a block with size proportional to the connected blocks, in averaged out area. The process continues until all blocks are connected or removed if they are too small (This can be changed by tweaking the parameters). The output of this process will be a list of ROIs (Region On Interests) as a (X,Y,W,H) tuples list. The largest ROI is sent to the tracker to initiate tracking on the object in the ROI. Once the tracker is initiated successfully it will either follow the moving object, or freeze on the same place. To avert losing the target and locking on the background, the tracker is stopped after N seconds of motionlessness. The number of seconds to wait (N) can be tweaked by user

Samples

Motion Detector -- the motion detector marks the largest motion object with green ROI and [TARGET] mark

Motion Detector

Tracker -- the motion detector picked a target and initiated the tarcker right away.

Motion Tracker

multiprocessed-motiondetector-tracker's People

Contributors

miker2808 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.