OpenCV library for Dynamic Textures (libdt)
v1.0

Antoni B. Chan, Adeel Mumtaz
Department of Computer Science
City University of Hong Kong

Copyright (c) by Antoni B. Chan, Adeel Mumtaz 2014-12-20.


DESCRIPTION

This is an OpenCV based, platform independent library for Dynamic Teture (DT) models. It is implemented with C++ and OpencV library. This library contains the EM algorithm for learning DTs and DT mixture models, and the HEM algorithm for clustering DTs. It also contains code for video processing (e.g., patch extraction) and serialization of DT models. Other than these it contains implementations of various DT-based application frameworks, such as motion segmentation and Bag of Systems (BoS) framework. If properly configured it can work with any version of OpenCV. Precompiled Windows and Linux binaries and libraries are also included with the package.

ORGANIZATION

The root directory contains the following directories:

src/ source code, separated into different directories/libraries. Contains Makefiles for compiling on Linux.
testdata/ example data for test programs and demos.
vs2010/codebase Visual Studio 2010 solution directory for all projects (Windows).
linux/ directory for compiled Linux programs and libraries (generated using Makefiles).
win/ directory for Windows executables and libraries (generated using Visual Studio).
doxygen/ documentation (automatically generated with doxygen).

Note that the contents of linux/, win/, and doxygen/ are pre-populated. Linux binaries were compiled using "CentOS release 6.4" (Final) (Linux version 2.6.32-358.23.2.el6.x86_64, gcc version 4.4.7 20120313 (Red Hat 4.4.7-3)) and OpenCV 2.4. Windows binaries were compiled on "Windows 7 (64-bit)" and OpenCV 2.3.1.

Source Files

Source files are organized in the src directory into various libraries, each within its own directory. All source code is written in C++, and compatible with both Linux and Windows. If you use the standard OpenCV functions, then this should not be a problem.

The root "src/" directory contains the following important files:

options.h global settings for the library: contains macros for the default Mat type.
Makefile master Makefile for compiling on Linux.
Doxyfile settings for compiling documentation with Doxygen.

The following libraries are currently available:

bufferer Class for writing and reading DT models from files.
demos source code for different demo programs, which use other libraries.
dytex dynamic texture library.
platInd wrapper for platform independent functions for both windows and linux.
stats statistics library.
utils Miscellaneous utility functions (e.g., Mat operations).
video video processing utilities.

Each library directory contains its own Makefile for compiling that library. In general, the various classes are compiled into a library file (libXXX.a), which is then used with a corresponding header file (libXXX.h). More documentation can be found in source code, and in the documentation generated by doxygen.

Demo Projects/Files

In order to familiar quickly with different libraries, "libdt" comes with a set of demo programs. Source files for all demo programs can be found in src/demos. Currently, following Demo programs are included:

test_HEM.cpp DTM clustering demo using the HEM algorithm
test_HEMDTM.cpp Video Annotation demo
test_videoSegm.cpp Video Segmenttaion demp
test_BoSClassification.cpp Bag of Systems motion classification demo

Source File vidSeqSegmParams.cpp contains code to read parameter for different demos.

LINUX USAGE & INSTALLATION

Compiling in Linux

The libraries are compiled on Linux using Makefiles. A Makefile contains the options and libraries used to compile and link the various programs. The main directory and each subdirectory contain Makefiles. To compile the library in Linux, run this in the root source directory (src/):

make

This will go through each sub-directory and compile the libraries (by calling make within each directory). The libraries will then be copied to the linux/lib directory, and programs to linux/test.

To compile the test/demo programs, run:

make test

The test programs will copied to linux/test.

To compile the documentation, run:

make docs

The documentation will be stored in doxygen/html.

Finally, to clean up all the compiled objects, run:

make clean

The make command can also be run in the subdirectories, to just compile that subdirectory. For example:

cd video
make clean
make
make test

will move into the video subdirectory, delete all compiled objects, and then recompile the library and test programs.

Running in Linux

In order to use OpenCV, you need to add /usr/local/lib to the library path first. This can be achieved with the following command:

setenv LD_LIBRARY_PATH /usr/local/lib

or by editing your .bashrc file.

The linux binaries are stored in the linux/bin and linux/test directories, with .bin or .testbin file extensions. For example, you can run:

cd linux/test
./test_BoSClassification.testbin

to execute the demo program BoS motion classification, with dynamic textures.

WINDOWS USAGE

A visual studio 2010 solution named codebase located in vs2010\codebase is developed in order to edit, compile and debug, different demos and modules, present in the "libdt". In order to use OpenCV, you need to edit the following visual studio property page files. Paths to openCV include and lib directorires must be set according to your installation of OpenCV.

Visual Studio solution "Codebase" either consist of a module which will be compiled as static library or a demo project whose output is the executable. All the source code of the modules and demo projects is linked from the src/ directory of the library. Output for the module projects goes to win\lib and output of the demo projects goes to win\bin directories. Currently "codebase" solution consist of 10 projects out of which 6 are module projects and 4 are demo projects for testing/learning various modules.

Compiling and Running in Windows

All 10 projects can be configured in debug or release mode and can be build/run without using visual studio 2010. Working directory for all the demo project is configured as win\bin, therefore while debugging all the paths that goes to some test data are relative to this directory.

REFERENCES

If you use this code, please cite the corresponding paper:

HEM algorithm for DTs, BoS Mumtaz, A.; Coviello, E.; Lanckriet, G.; Chan, A., "A Scalable and Accurate Descriptor for Dynamic Textures using Bag of System Trees," IEEE Transactions on, Pattern Analysis and Machine Intelligence, 2014
HEM algorithm for DTs, BoS Mumtaz, A.; Coviello, E.; Lanckriet, G.R.G.; Chan, A.B., "Clustering Dynamic Textures with the Hierarchical EM Algorithm for Modeling Video," IEEE Transactions on, Pattern Analysis and Machine Intelligence, July 2013
EM algorithm for DTMs, motion segmentation Chan, A.B.; Vasconcelos, N., "Modeling, clustering, and segmenting video with mixtures of dynamic textures," IEEE Trans. on Pattern Analysis and Machine Intelligence (TPAMI), 30(5):909-926, May 2008.

Other related dynamic texture references:

CONTACT INFO

Please send comments, bug reports, feature requests to Antoni Chan (abchan at cityu dot edu . hk).

CHANGE LOG