image = | qrSolverImg (inSeqImg1,inSeqImg2,inNbFeatures) |
Solves an overdeterminated system Ax=b for each pixel using a QR decomposition.
In some cases, it can be necessary to find the parameters of an analytic model. States before and after applying the model are known, but the way the data are transformed is a black box. A common example is finding the motion field between two images. In that example, positions in both images are known but we want to model the displacement for all pixels
Such a transform can be expressed as an overdetermined linear system . Where
is a set of data, covering several features (for example gratients) on several images,
is a known result we want to reach with an estimate of the linear model parametrized by the coefficients of
.
We have here more equations than unknowns. The most ordinary way to solve the solution is the least squares method :
To efficiently achieve this calculation, it is possible to decompose into two matrices
and
. We can rewrite the problem :
The first advantage of this factorization is that , we can rewrite the previous equation :
The second advantage is that is diagonal, we can easily solve the system. We choose the Householder reflection to achieve the decomposition.
Given two images InSeqImg1 and InSeqImg2, this algorithm solves the system to find the parameters x, stored in the image OutRealSeqImg.
The input image InSeqImg1 is assigned to , whereas the vector
is represented by InSeqImg2. For each pixel, the coefficients are stored along the temporal dimensions. In the case of InSeqImg1, we use a row-major representation of the matrix
.
The temporal size of equals the temporal size of
multiplied by the temporal size of
, and the temporal size of
equals the number of features used in the linear system.