Search code examples
imagematlabcalibration

rectifyStereoImages (Image rectification) output looks distorted


I have implemented rectifyStereoImages, but the result looks weird. Please look at the images attached. Both cameras are the same model (Logitech C920).

left = webcam(3);
right = webcam(1);
I1 = snapshot(left);
figure(1);
imshow(I1);
I2 = snapshot(right);
figure(2);
imshow(I2);
[J1,J2]=rectifyStereoImages(I1,I2,stereoParams,'OutputView','full');

figure(3);

imshow(cat(3,J1(:,:,1),J2(:,:,2:3)),'InitialMagnification',50);

clear left right

1 2 3


Solution

  • I tested the cameras several times, and I guess, the reason is the camera itself. I cut the right part of the cameras before calibration, and it looks fine now.

    I originally captured images with resolution of 1280 x 720, and I only took 960 x 720 of the left side.

    enter image description here