Image registration using robust least squares with applications to image stitching