Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 2.7 KB

README.md

File metadata and controls

76 lines (49 loc) · 2.7 KB

condensationPy - Condensation Tracking in Python

Condensation Tracking algorithm in Python - a version based on the original OpenCV code

Background

Forked from https://github.com/cesarorosco/condensationPy for use in teaching within the undergraduate Computer Science programme at Durham University (UK) by Prof. Toby Breckon.

Code Details:

  • live_tracking.py: live tracking of selected objects from webcam / video file
  • Condensation.py: main tracking object for Condensation approach
  • camera_stream.py: threaded camera capture interface

live_tracking.py runs with a webcam connected or from a command line supplied video file of a format OpenCV supports on your system (otherwise edit the script to provide your own image source).

Tested with OpenCV 3.x / 4.x and Python 3.x.


How to download and run:

Download each file as needed or to clone the entire repository as follows:

git clone https://github.com/tobybreckon/condensationPy.git
cd condensationPy
python3 ./live_tracking.py [optional video file]

Command line usage of the main tracking demo is as follows:

$ python3 ./live_tracking.py -h
usage: live_tracking.py [-h] [-c CAMERA_TO_USE] [-r RESCALE] [video_file]

Perform Condensation (particle filter) tracking on an incoming camera image

positional arguments:
  video_file            specify optional video file

optional arguments:
  -h, --help            show this help message and exit
  -c CAMERA_TO_USE, --camera_to_use CAMERA_TO_USE
                        specify camera to use
  -r RESCALE, --rescale RESCALE
                        rescale image by this factor

Once the tracking script is running perform the following steps

  • use the sliders in the "Hue Histogram Back projection" to isolate (in white) the colours of the object you want to track.
  • click and drag in the main colour image window to select an object to track.
  • ...
  • press 'x' to exit

Demo source code is provided "as is" to aid learning and understanding of topics on the course and beyond.


If you find any bugs raise an issue (or much better still submit a git pull request with a fix) - [email protected]

"may the source be with you" - anon.