1

I have two images from a stereo camera of the same scene, but few different perspectives (imgLeft and imgRight). Now, I want to find a ROI (red rectangle in the image below) of the right image in the left one. I need to do this very fast, because I'm doing this in a video. How can I do this? I do not have the nonfree of OpenCV; but I have CUDA installed.

imgRight:enter image description here

imgLeft:enter image description here

Humam Helfawi
  • 19,566
  • 15
  • 85
  • 160
  • 1
    Have you calibrated the stereo pair? If you know camera matrices, this should be straightforward. – dhanushka Jan 10 '16 at 02:44
  • Yes, I have done this. But as I do not know the distance to the ROI, I cannot compute them using these matrices. Instead, I have to use kind of matching-algorithm. Any idea which one is best? As the images are very similar, I do not have to use algorithms like SURF or SIFT. Is there a fast one that works with such similar images? –  Jan 10 '16 at 13:56
  • You can parameterize the target points using the depth, which is unknown. This way the resulting relation is linear in depth (right?). So may be you can use this information to reduce your search space. – dhanushka Jan 12 '16 at 07:02

1 Answers1

0

This should be your friend http://docs.opencv.org/2.4/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowpyrlk

All you need to do is to find feature points inside this rectangle and pass them to the cv::calcopticalflowpyrlk to get there peers in the second image. You may need to make some filtering for the points to make sure that the tracking was perfect like for example pass them to cv::findHomography using CV_RANSAC flag and check the mask output.

The operation is fast and real-time. There is also a CUDA version of this method.

Humam Helfawi
  • 19,566
  • 15
  • 85
  • 160