Minimizing Sum of Least Squares in Matlab

721 Views Asked by At

I am working on this minimization problem for image warping that I want to solve in Matlab: enter image description here

Each feature $p$ can be presented by a 2D bilinear interpolation of the four vertices $V_p = [v_p^1, v_p^2, v_p^3, v_p^4]$ of the enclosing grid cell: $p = V_p w_p$, where $w_p = [w_p^1, w_p^2, w_p^3, w_p^4]^T$. We expect that the corresponding point $\hat p$ can be represented by the same weights of the warped grid vertices $\hat V_p = [\hat v_p^1, \hat v_p^2, \hat v_p^3, \hat v_p^4]$. We have the first term to minimize: $$E_d(\hat V) = \sum_p||\hat V_p w_p - \hat p||$$ Where $\hat V$ contains all the warped grid vertices.

We also have a second term to minimize: $$E(\hat V) = \sum_{\hat v}||\hat v - \hat v_1 - sR_{90}(\hat v_0 - \hat v_1) ||^2; R_{90} = \begin{bmatrix} 0 & 1 \\ -1 & 0 \\ \end{bmatrix} and s = ||v-v_1||/||v_0-v_1||$$

So the final energy to minimize is: $$E(\hat V) = E_d(\hat V) + E_s(\hat V)$$ I am trying to minimize this function in Matlab with the unknowns are the positions of the vertices $\hat v_i$ but I am not making any progress. Is there any hints or ways to simply the minimization problem to be solved in Matlab ? Thank you.