opencvcomputer-visionstereo-3dstereoscopy

Find corresponding 2d point on Right Image in Stereo Camera


I have a point(xl,yl) in left image in a stereo camera. I want to determine where this same point maps in the right image let's say point(xr,yr) in right image.I have all the rotational matrices & translation matrices using camera calibration using opencv.


Solution

  • You can do this with simple 2D Point Matching. I got something like this in OpenFrameworks working:

    cv::Ptr<cv::DescriptorExtractor> ext = cv::DescriptorExtractor::create("ORB");
    
    cv::Mat descriptors_1, descriptors_2;
    
    //The images are cv::Mat and the Points are std::vector<cv::KeyPoint>> which I got from cv::FASTX()
    ext->compute(_leftImage, _leftPoints, descriptors_1);
    ext->compute(_rightImage, _rightPoints, descriptors_2);
    
    cv::BFMatcher matcher;
    
    std::vector<cv::DMatches> matches;
    matcher.match(descriptors_1, descriptors_2, matches);
    

    matches then has references to the fitting pairs of points in each image. It would still need some cleaning to get rid of outliers (all the correct matches should be parallel to each other ;) ), but with some work you should be able to rectify the two images to each other.