Search code examples
matlabmatlab-cvst

Image rectification using rectifyStereoImages in MATLAB


i want to rectify two stereo image captured by two cameras. I want to do the rectification using the MATLAB function rectifyStereoImages:

rectifystereoimages

My Problem is that the stereoParams which I computed using stereoCameraCalibrator are not accepted by the function:

[J1,J2] = rectifyStereoImages(I1,I2, stereoParams)

Here is the code snippet:

imPath1 = 'Webcam1_00001.jpg';
imPath2 = 'Webcam2_00001.jpg';
imW1 = imread(imPath1);
imW2 = imread(imPath2);

load stereoParams.mat;

[I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams);

Running this leads to the output:

Attempt to execute SCRIPT rectifyStereoImages as a function: /home/.../rectifyStereoImages.m

Error in rectifyStereoImages (line 8) [I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams);

I think the loaded variable stereoParams is OK but I can not see what the problem is.

Hope you have some idea.

Thanks in advance!


Solution

  • Solving the problem:

    1. own calibration implemented
    2. using [I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams,'OutputView','full'); instead of [I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams);

    Thank you for you help and suggestions!