5.3.4.108. Function motion_compute
Defined in File motion_compute.h
5.3.4.108.1. Function Documentation
-
void motion_compute(const RoI_basic_t *RoIs0_basic, const RoI_basic_t *RoIs1_basic, const RoI_asso_t *RoIs1_asso, RoI_motion_t *RoIs1_motion, const size_t n_RoIs1, motion_t *motion_est1, motion_t *motion_est2)
Compute the global motion estimation and, after global motion compensation, compute the movement of each RoI. In order to compute the motion estimation, the translation vector \(\vec{t}\) and the angle of rotation \(\theta\) is calculated as follows:
\[ \theta = \arctan\left(\frac{ \sum_{i=1}^N [(y_i'-\bar{y})(x_i-\bar{x}) - (x_i'-\bar{x})(y_i-\bar{y})]}{\sum_{i=1}^N[(x_i'-\bar{x})(x_i-\bar{x}) + (y_i'-\bar{y})(y_i-\bar{y})]} \right), \]\[\begin{split} \vec{t} = \begin{bmatrix} t_x \\ t_y \\ \end{bmatrix} = \begin{bmatrix} x' - x \cdot cos(\theta) + y \cdot sin(\theta)\\ y' - x \cdot sin(\theta) - y \cdot cos(\theta) \end{bmatrix}, \end{split}\]where \(N\) is the number of RoIs, \((x,y)\) and \((x',y')\) are the centroids of RoIs at \(t -1\) and \(t\), respectively, and\[ \bar{x} = \sum_{i=1}^N x_i, ~~~~~ \bar{y} = \sum_{i=1}^N y_i, ~~~~~ \bar{x}' = \sum_{i=1}^N x'_i, ~~~~~ \bar{y}' = \sum_{i=1}^N y'_i . \]For the first global motion estimation, all the associated RoIs are considered. For the second global motion estimation, only the RoIs considered as “not moving” are considered. To be considered in movement the motion norm of the RoI has to be higher that de motion standard deviation.- Parameters
RoIs0_basic – Basic features (at \(t -1\)).
RoIs1_basic – Basic features (at \(t\)).
RoIs1_asso – Association features (at \(t\)).
RoIs1_motion – Motion features (at \(t\)).
n_RoIs1 – Number of connected-components (= number of RoIs) (at \(t\)).
motion_est1 – First global motion estimation.
motion_est2 – Second global motion estimation.