Question

I followed this page(http://www.mathworks.cn/cn/help/vision/ug/stereo-image-rectification.html) and used estimateFundamentalMatrix function to compute the fundamental matrix,but I received an error message form MATLAB command window saying that:

Error using estimateFundamentalMatrix
Expected matched_points1 to be one of these types:

numeric

My code:

img1 = rgb2gray(imread('37_1.jpg'));
img2 = rgb2gray(imread('38_1.jpg'));

img1=im2double(img1);
img2=im2double(img2);

points1 = detectSURFFeatures(img1,'MetricThreshold', 2000);
points2 = detectSURFFeatures(img2,'MetricThreshold', 2000);

[featurePoint1, validPoint1] = extractFeatures(img1, points1);
[featurePoint2, validPoint2] = extractFeatures(img2, points2);

indexPairs = matchFeatures(featurePoint1, featurePoint2, 'Metric', 'SAD', 'MatchThreshold', 5);
matchedPoints1 = validPoint1(indexPairs(:, 1),:);
matchedPoints2 = validPoint2(indexPairs(:, 2),:);

[fMatrix, epipolarInliers, status] = estimateFundamentalMatrix(matchedPoints1, ...
matchedPoints2, 'Method', 'RANSAC', 'NumTrials', 10000, 'DistanceThreshold', ...
0.1, 'Confidence', 99.99);

My programming environment is Win7 plus MATLAB R2012b.

Was it helpful?

Solution

The reason why I got the error message mentioned above is because the page is for R2014a,but my MATLAB is R2012b,so it is a version problem. We just need to change the code like this:

[fMatrix, epipolarInliers, status] = estimateFundamentalMatrix(matchedPoints1.Location, ...
matchedPoints2.Location, 'Method', 'RANSAC', 'NumTrials', 10000, 'DistanceThreshold', ...
0.1, 'Confidence', 99.99);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top