Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 1 commit ahead, 23 commits behind KitwareMedical:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Python (Linear / Non-Linear) Dynamical Systems Toolkit (pydstk). This package implements two dynamical system variants that are commonly used in computer vision: Dynamic Textures (i.e., linear DS) and Kernel Dynamic Textures (i.e., non-linear DS). In addition, several approaches to measure the similarity between dynamical systems are implemented.


Take a look at the included pydstk-Tutorial.ipynb IPython notebook (which is structured as a tutorial to get started with pydstk).


  1. numpy
  2. scipy
  3. OpenCV (Python wrapping, tested with v2.4.5)
  4. SimpleITK (Python wrapping)
  5. nose
  6. termcolor

To check if those packages are available on your system, try

import cv2
import scipy
import numpy
import termcolor
import SimpleITK

in a Python console. If no error occurs, you are all set!


For the seminal work on Dynamic Textures, see:

  author = {G.~Doretto and A.~Chiuso and Y.~N.~Wu and S.~Soatto},
  title = {Dynamic Textures},
  journal = {Int. J. Comput. Vision},
  year = 2001,
  pages = {91--109},
  volume = 51,
  number = 2} 

Similarity measurement between two linear dynamical systems by means of subspace-angles is discussed in:

  author = {K.~{De Cock} and B.~D.~Moore},
  title = {Subspace angles between linear stochastic models},
  booktitle = {CDC},
  pages = {1561-1566},
  year = 2000}

Kernel Dynamic Textures (as well as the non-linear extension of the subspace-angle based similarity measure) were introduced in:

  author = {A.~B.~Chan and N.~Vasconcelos},
  title = {Classifying Video with Kernel Dynamic Textures},
  booktitle = {CVPR},
  pages = {1-6},
  year =  2007}

Supported I/O file formats

The package dsutil contains a set of I/O routines to load data from harddisk. Three common ways of loading video data are:

  • load an actual video file (via loadDataFromVideoFIle)
  • load a video represented as a collection of frames (via loadDataFromIListFile)
  • load a video as a large data matrix (via loadDataFromASCIIFile)


import dsutil.dsutil as dsutil

in a Python console to get more information about the format of the input file(s) and the function parameters (here for function loadDataFromASCIIFile).

Running the unit-tests

Unit-testing in pydstk is done using nose. All tests reside in the tests directory. To run, for instance, the tests for module, use:

$ nosetests tests/ -v

Where can I get data material ?

Several resources for getting dynamic texture data can be found on the internet. An extensive database of dynamic texture is available in the Dyntex created by R. Peteri et al. Another interesting set of videos (e.g., for recognition experiments) is the Traffic database created by A. Chan and N. Vasconcelos that was used in

  author = {A.~B.~Chan and N.~Vasconcelos},
  title = {Probabilistic Kernels for the Classification of Auto-regressive Visual Processes},
  booktitle = {CVPR},
  year = {2005}}

Another dataset, from the field of medical Ultrasound imaging is available from MIDAS. This dataset contains a collection of Ultrasound videos acquired on a (hand-made) phantom. The videos (in AVI format) are split into key videos and search videos and can be used to experiment with approaches that try to recognize the key videos in the search videos for instance. The scripts directory of pydstk contains a script that can automatically download this database. You only need to adjust the file scripts/pydas.config.example to your MIDAS account settings. This database was used in

  author = {R. Kwitt and N. Vasconcelos and S. Razzaque and S. Aylward},
  title = {Localizing Target Structures in Ultrasound Video - A Phantom Study},
  journal = {Medical Image Analysis},
  volume ={17},
  number = {7},
  pages = {712-722},
  year = 2013}


  author = {R. Kwitt and N. Vasconcelos and S. Razzaque and S. Alyward},
  title = {Recognition in Ultrasound Videos: Where Am I?},
  booktitle = {MICCAI},
  year = 2012}

Some example applications

Estimating a dynamic texture model (DT)

  • DT states: 5
  • Input data: video file tests/ultrasound.avi
  • Output data: DT model file /tmp/us-dt-model.pkl
$ python -i tests/data/ultrasound.avi \ 
               -n 5 \
               -t vFile \
               -e \ 
               -o /tmp/us-dt-model.pkl

Estimate and synthesize a video from a DT model

  • DT states: 5
  • Input data: video file tests/data/ultrasound.avi
  • Output data: /tmp/us-dt-model.pkl
  • Frame rate: 20 FPS
$ python -i tests/data/ultrasound.avi \
               -n 5 \
               -t vFile \
               -e \
               -s \
               -o /tmp/us-dt-model.pkl \
               -m 20

Estimating a kernel dynamic texture model (KDT)

  • KDT states: 5
  • Input data: video file tests/data/ultrasound.avi
  • Output data: /tmp/us-kdt-model.pkl
  • Kernel: RBF (default)
$ python -i tests/data/ultrasound.avi -n 5 -t vFile -o /tmp/us-kdt-model.pkl

Similarity measurement between two DT models

  • Source model: /tmp/us-dt-model.pkl
  • Reference model: /tmp/us-dt-model.pkl
  • Nr. of summation terms (for Lyapunov eq.): 50
python -s /tmp/us-dt-model.pkl /tmp/us-dt-model.pkl -n 50

Similarity measurement between two KDT models

  • Source model: /tmp/us-kdt-model.pkl
  • Reference model: /tmp/us-kdt-model.pkl
  • Nr. of summation terms (for Lyapunov eq.): 50
python -s /tmp/us-kdt-model.pkl -r /tmp/us-kdt-model.pkl -n 50

Online template detection in videos

  • coming soon!

Author: Roland Kwitt
Personal website:


No description, website, or topics provided.






No releases published


No packages published


  • Python 99.1%
  • Shell 0.9%