Code Monkey home page Code Monkey logo

sherlock's Introduction

Sherlock Logo

Sherlock

OpenCV in Python, with multiprocessing and shared memory!

A collection of small codes for processing live video (like from a webcam) with OpenCV. Image data in memory (NumPy arrays) are shared by multiple processes using numpy-sharedmem Python module. Parallel processing workflow is implemented with MPipe.

Download and Install

  1. First thing, you'll need OpenCV Python bindings on your system. Get it using YUM:

    yum install opencv-python
    

    or Aptitude:

    aptitude install python-opencv
    

    or Homebrew (on OS X):

    brew tap homebrew/science
    brew install opencv
    
  2. Okay, now get the project code:

    git clone https://github.com/vmlaker/sherlock
    
  3. Run make:

    cd sherlock
    make
    

Playback test

For starters, let's test your OpenCV Python bindings. This command shows live view from the first video device (i.e. /dev/video0) for a duration of 8 seconds:

make playcv2

Motion detection

The following cases demonstrate simplified motion detection. Each iteraton increases in complexity with cumulative changes intended to enhance performance.

  1. Run one process:

    make diffavg1
    
  2. Add parallel processing:

    make diffavg2
    
  3. Add shared memory:

    make diffavg3
    
  4. Add filtering:

    make diffavg4
    

Processing algorithm is a run-of-the-mill foreground/background segmentation using scene average. Consider profiling resource usage by running with time command.

Object detection

Objects in the video stream are detected using Haar feature-based cascade classifiers. Active classifiers are listed in src/util/cascade.py file. By default, these are vanilla classifiers shipped with OpenCV distribution. You can edit this file to activate (or deactivate) classifiers, change search paths, add your own custom classifiers, and configure global object detection parameters.

Run face detection serially:

make object1

Run face detection in parallel:

make object2

sherlock's People

Contributors

vmlaker avatar

Watchers

 avatar  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.