In addition to the code, we also provide several examples in the toolbox. These are meant for the user to get aquainted with the toolbox. We now describe a few examples here.
Once the toolbox has been downloaded, the toolbox can be added by running matlab in the uncompressed directory and invoking the following command
This will add all the necessary paths to the MATLAB path. Alternatively, the paths can be manually added using the addpath command.
In order to see how the LDS model can be used to learn the parameters of the video sequence and generate them, we have provided two example files namely: learnAndSynthesizeColorOcean.m and learnAndSynthesizeOcean.m. As the name suggests, one example learns and generates a color sequence while the latter does this in gray scale. The color sequence can be invoked using learnAndSynthesizeColorOcean or learnAndSynthesizeOcean. The learning of the parameters is done by the following lines of code
Here we used a model order of n=50 which is conistent with the original Dynamic Texture Paper (Doretto IJCV03) and a noise order of nv=1. The structure dParams contains a class field which determines if we have to identify all the paramters of the model of just a subset. The option used here indicates we would like to learn the basic paramters and the noise parameters. One could also use dParams.class=3 for full set of parameters. However, one cannot use dparams.class=1 as this will not identify the parameters associated with the noise. These parameters are required if we would like to synthesize using the model parameters. Once the paramters of the LDS are indetified, we can generate the video sequence using
Here p is the number of pixels and F is the number of frames that we want to generate. For the color case p = 3 x r x c as we consider each frame as the concatenation of the three color channels, while for the gray scale case p = r x c. Examples of the synthesis results after running either of the functions would look like: [Color Synthesis] [Gray Synthesis]
It is well known that the paramters of an LDS are unique only upto a change of basis. Our toolbox contains code that can covert the paramters to different forms namely the Reachability Canonical Form (RCF) and the Jordan Canonical Form (JCF). Once the system parameters have been identified, they can be converted into the canonical form using
Here the 1 is for the RCF and can be substituded with 2 if one wants the JCF. Note that this only returns P which is the basis change matrix. The parameters then need to be converted to the new basis using
The following figures show the eigenvalues of the A matrix in its original form and after converting them to the different canonical forms. Notice that we see that the eigen values are identical here for the parameter in different basis.
We can also plot the matrix to see the different forms. The following figure shows the A matrix in the different canonical forms. In this figure the color represent the values, with blue being low and red being high. One can clearly see the different structure of the canonical forms in this image.
Our final example shows how we can compute distances between different LDSs. Our toolbox contains code to calculate a large number of distances and kernels. These can be broadly classified into two categories: Subspace Angle based and Binet-Cauchy Kernel based. The example code calculates all the Subspace angle distances. Given a set of LDS stored in a cell array, the different distances can be calculated as
Note that this command calculates 6 distances based on subspace angles namely the Finsler, Martin, Gap, Frobenius distances and also the Martin Kernel derived distance and the Martin Kernel. We request the user to refer to the documentation for a more comprehensive list of distances. The plot of these distances as calculated by the example code is as follows