Skip to content
High-performance realtime video processing. In Python!!
Python Makefile
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add gitignore file. Oct 3, 2013
LICENSE Update license year. Jan 20, 2015
Makefile Port for OS X. May 2, 2014
README.rst Remove obsolete --recursive directive to clone command, change protoc… Oct 13, 2015


Sherlock Logo


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
  3. Run make:

    cd sherlock

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/ 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
You can’t perform that action at this time.