My inputs are several binary images like:first binary image to be registersecond binary image to be register

They have globally the same content but may be unregistered as they are produced from a hand camera. What I would like to compute is the 2D displacement vector from the first image to the second. I use OpenCV and my first attempt was to compute feature points (SURF algorithm) and the affine transform between both images. But of course, feature description are kinda poor on a binary image, therefore the matching is difficult and the matching map very inaccurate.

Does anyone has an idea how I could do this?


1 Answer 1


I am somewhat surprised that feature points don't work that well. I have had success registering shapes like yours using either

  • Harris points, this is a corner detector, in combination with the RANSAC algorithm. See the wiki or Peter Kovesi his site
  • Using a feature detector like SURF or SIFT in combination with an edge map of the image prior to feature detection followed by some form of robust matching.


I gave it a go with matlab and tried some variations on this theme. Currently I use

  • SIFT features from the edge map to ascertain rotation and scaling, although they are very small between the images you provided
  • RANSAC for robust matching
  • Cross correlation to ascertain the translation between the two images

Robust match Before registration After registration

Source on github.

An alternative for RANSAC could be the Hough transform voting/binning approach that was proposed by the inventor of SIFT, David Lowe.

  • $\begingroup$ I know Harris, but I don't have fast and robust matching algorithm to be sure I get the same points from one image to another. Plus, Ransac is not usable as is in OpenCV... $\endgroup$ Jan 13, 2012 at 9:45
  • $\begingroup$ Thanks a lot for your effort. It shows a nice way to perform this. I finally modified the way I do what I need to do, because features computation and matching is too CPU-intensive for me. Thanks anyway, you did a good job! $\endgroup$ Jan 17, 2012 at 8:57
  • $\begingroup$ Stephane, could you please add your solution as well to the site? $\endgroup$
    – Maurits
    Jan 17, 2012 at 10:45
  • 1
    $\begingroup$ well, the thing is I don't answer to the question asked so it's not relevant to put that here. What I did is a detection of the blobs of the image and a description of each blob by the minimum amount of points possible. I wanted the 2D displacement to compute a temporal accumulation, but I won't do that anymore, as a vectorial description of the blobs is sufficient. $\endgroup$ Jan 18, 2012 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.