Copyright (c) by Antoni B. Chan, Adeel Mumtaz 2014-12-20.
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.
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 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.
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.
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/):
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:
The test programs will copied to linux/test.
To compile the documentation, run:
The documentation will be stored in doxygen/html.
Finally, to clean up all the compiled objects, run:
The make command can also be run in the subdirectories, to just compile that subdirectory. For example:
will move into the video subdirectory, delete all compiled objects, and then recompile the library and test programs.
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:
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:
to execute the demo program BoS motion classification, with dynamic textures.
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.
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.
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: