Documentation‎ > ‎


The crtool crBOD computes the Bi-Orthogonal Decomposition of either a tracking sequence, or the pair of u flow and v flow sequences.
A bi-orthogonal decomposition is a 2 sided POD or a 2-sided and un-centered PCA.

This function may use lots of memory. A lower bound can be estimated by
2*T*(2N+T)*precision   (in bytes)
 where T is the number of frames in the sequence, N is the number of features (cells) and 'precision' is 4 for single (default) and 8 for double

Ex: 70*100 cells flow over 1 min sequence at 25Hz requires at least
200 MBytes of memory using single precision and 400 using double.

This is a lower bound, twice this amount is recommended.


crBOD does not provide a user interface. It is called by: 
  • crBOD(     tracking,     parameters )
  • crBOD( uFlow, vFlow, parameters )

where tracking, uFlow and vFlow are CRVideo sequences of either a video tracking or optical flow; and parameters is a CRParam, a structure or a list of pairs <parameter_name , parameter_value> defining the following parameters:
  • precision          either 'single' (default) or 'double'. This is the data precision used for computations.
  • modeNumber  the number of mode to compute, a number or 'all' (default)
  • cellSize            - for flow only - used to compute the x & y coordinates of flow grid cells (default 1).
  • outlier               - for flow only - detect and replace obvious outliers  (default 0: don't)
  • output               (optional) a sub-structure which can contain
    • file           save the computed bod structure in this file
    • path        to append before 'file' (it can also be included in the 'file' parameter directly) 
    • name      if provided, it overload 'file', and a CRData with the given name and containing the returned structure is added.

These parameters default value are usually good, but for outlier which might be necessary when the optical flow contain strong errors. For none zero outlier value, all speed data that are out of mean +/- outlier * std are considered outliers and are filtered using temporal interpolation. mean and std are the mean and standard deviation of all speed data.


crBOD return a structure containing the fields:
  • x             coordinates of flow cells or initial position of tracked features
  • y             coordinates of flow cells or initial position of tracked features
  • chronos component   of the BOD decomposition - matrix   T-by-K
  • topos     component   of the BOD decomposition - matrix 2N-by-K
  • alpha     coefficient of the BOD decomposition     - vector of length K
  • trace      trace of the correlation matrix (i.e. the total kinetic energy, which equals the sum of all alpha)
where N is the number of flow cells or tracking features, K is the number of modes, and T is the number of sequence frames.

In case of optical flow, cells that are always NaN (typically those that where masked) are removed before computing BOD. The x and y coordinates help to find which cells are indicated by the topos column indices. Other (local) NaN are filtered using temporal interpolation.