Image coregistration function.