1. A method, comprising: calculating a first distance matrix for a first binary image and a second distance matrix for a second binary image; calculating a first gradient matrix for the first distance matrix and a second gradient matrix for the second distance matrix; calculating, using the first gradient matrix and a difference between the first and the second distance matrices, a displacement matrix that defines a change in position between elements in the first distance matrix and corresponding elements in the second distance matrix; identifying outlier elements comprising elements in the displacement matrix satisfying at least one predetermined criterion; and replacing the identified outlier elements with calculated interpolated values.