so I had an assignment in Matlab for solving for a homography (and stitching images) and I solved it by converting the coordinates into homogeneous form (since scale doesn't matter in our assignment) by sticking a 1 at the end and then using the built in linear least squares operator (x = A\B that one).
My though process was if a homography is a transformation such that Hx=x' (where x is a set of points in image1 and x' is a corresponding set of points in image2), if you solve the linear least squares equation H = x'\x, that should give you the H that most closely transforms all points in image1 to the domain of image2.
However, all of the literature I read used the SVD method, where you try to minimize AX=0, where A is this massive matrix storing all of the coefficients and X is the elements of the homography in vector form
(like the one you can see in the answer here: How to compute homography matrix H from corresponding points (2d-2d planar Homography))
And you basically do [U S V] = svd(A) and then X is the last column of V (corresponding to the smallest singular value).
From what I understand, A\B is supposed to be for nonhomogenous least squares and a homography needs homogeneous least squares. But after I converted my x,y points into homogenous coordinates, ran the built in linear equation solver and then used my homography to warp and image and stitch them together, I got a pretty good mosaic. Maybe it was because we were doing a pretty simple panorama and it just happened to work out.
But is there some major difference between the two methods? I converted nonhomogenous coordinates into homogenous coordinates before using mldivide. That seems like it should be equivalent to the other method, but I'm not sure.
Thanks ahead of time!