Ask Your Question

Image Registration by Manual marking of corresponding points using OpenCV

asked 2013-04-16 20:55:07 -0600

Karthik gravatar image

updated 2013-04-16 21:01:46 -0600

  1. I have a processed binary image of dimension 300x300. This processed image contains few object(person or vehicle).

processed binary image

  1. I also have another RGB image of the same scene of dimensiion 640x480. It is taken from a different position

enter image description here

note : both cameras are not the same

I can detect objects to some extent in the first image using background subtraction. I want to detect corresponding objects in the 2nd image. I went through opencv functions

All these functions require corresponding points(coordinates) in two images

In the 1st binary image, I have only the information that an object is present,it does not have features exactly similar to second image(RGB).

I thought conventional feature matching to determine corresponding control points which could be used to estimate the transformation parameters is not feasible because I think I cannot determine and match features from binary and RGB image(am I right??).

If I am wrong, what features could I take, how should I proceed with Feature matching, find corresponding points, estimate the transformation parameters.

The solution which I tried more of Manual marking to estimate transformation parameters(please correct me if I am wrong)

Note : There is no movement of both cameras.

  • Manually marked rectangles around objects in processed image(binary)
  • Noted down the coordinates of the rectangles
  • Manually marked rectangles around objects in 2nd RGB image
  • Noted down the coordinates of the rectangles
  • Repeated above steps for different samples of 1st binary and 2nd RGB images

Now that I have some 20 corresponding points, I used them in the function as :

findHomography(src_pts, dst_pts, 0) ;

So once I detect an object in 1st image,

  • I drew a bounding box around it,
  • Transform the coordinates of the vertices using the above found transformation,
  • finally draw a box in 2nd RGB image with transformed coordinates as vertices.

    But this doesnt mark the box in 2nd RGB image exactly over the person/object. Instead it is drawn somewhere else. Though I take several sample images of binary and RGB and use several corresponding points to estimate the transformation parameters, it seems that they are not accurate enough..

What are the meaning of CV_RANSAC and CV_LMEDS option, ransacReprojecThreshold and how to use them?

Is my approach good...what should I modify/do to make the registration accurate?

Any alternative approach to be used?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-20 14:23:19 -0600

Guanta gravatar image

I don't know the answer to all of your questions, but here to two of your questions:

  • CV_RANSAC works as follows: 1. it chooses a subset of your points, 2. it computes the homography matrix (perspective transformation) 3. it divides the points in inliers and outliers (by using the ransacReprojecThreshold, which is the maximum distance between the true point-correspondence and the estimated point-correspondence). This procedure is repeated several times and the homography matrix which satisfies a specific confidence (findHomography has set it to 0.995) or after several iterations (findHomography uses 2000 iterations) is returned.

  • You are right, the typical keypoints won't work for binary images, however you could go the other way around and try to extract the shapes of your RGB image and then match both shapes using a shape-matching algorithm. If you have a static scene and want to detect moving objects like cars and humans, you could make a background subtraction and then edge-detection (Canny), findContours --> shapes.

edit flag offensive delete link more


Thank you Guanta. I think shape matching is a good idea... I ll try it soon... Any OpenCV links for that?

Karthik gravatar imageKarthik ( 2013-04-24 09:37:16 -0600 )edit

Question Tools


Asked: 2013-04-16 20:55:07 -0600

Seen: 2,370 times

Last updated: Apr 20 '13