Hello,
I have a pair of stereo images that I am trying to rectify. I used these functions in MATLAB R2019a to do so:
I1 = imread("IMG_1.jpg");
I2 = imread("IMG_2.jpg");
I1 = imrotate(I1, -90);
I2 = imrotate(I2, -90);
load("f.mat");
data = xlsread("keypoints", "Stereo_Images");
inliers1 = data(:, 1:2);
inliers2 = data(:, 3:4);
[t1, t2] = estimateUncalibratedRectification(f, inliers1, inliers2, size(I2));
[I1rect, I2rect] = rectifyStereoImages(I1,I2,t1,t2);
where size(I2) = [4032 3024 3]. I1 is the same size as I2. The estimateUncalibratedRectification function works fine and gives the following:
t1:
0.723608082608398 0.413928084852519 0.000195673701093778
-1.04138341841754 0.220928003587292 0.000104437948810851
3118.45167713170 2115.39968089010 1
t2:
0.141528790443488 9.91393350589689 -0.000221135398080506
-3.08031416824115 10.1812457508437 0.00481291825975873
21683.1995762877 -14612.6238125421 1
I am getting errors with the rectifyStereoImages function, however. This is the error I get:
Error using imref2d
Expected ImageSize to be positive.
Error in imref2d (line 195)
validateattributes(imageSize, ...
Error in rectifyStereoImages>rectifyUncalibrated (line 235)
outputViewRef = imref2d([height, width], xLim, yLim);
Error in rectifyStereoImages (line 119)
[rectifiedImage1, rectifiedImage2] = rectifyUncalibrated(I1, I2, ...
Error in task5a (line 17)
[I1rect, I2rect] = rectifyStereoImages(I1,I2,t1,t2);
I am not sure what the problem is... I tried going into imref2d and rectifyUncalibrated but it didn't let me even print height and width on there. Any help would be greatly appreciated!