matlabimage-processingmatlab-guidematlab-cvst

rectifyStereoImages throwing "Not enough input arguments error"


I am not trying to rectify a pair of stereo images but I am getting a strange error from the function

Error using rectifyStereoImages (line 106)
Not enough input arguments.

Error in RealTimeProcessing>captureButton_Callback (line 134)
[I1Rect, I2Rect] = rectifyStereoImages(I1, I2,stereoParams);

The line of code I have written is

[I1Rect, I2Rect] = rectifyStereoImages(I1, I2,stereoParams);

As you can see, the two images and the stereoParameters are present. I obtained the stereoParams by using the Stereo Camera Calibration Tool in MATLAB. Is there some input I am missing? The link to files are here. I have included the two input images and the stereoParams.


Solution

  • What does class(stereoParams) return?

    rectifyStereoImages function has two syntaxes: calibrated and uncalibrated. For the calibrated case it takes the two images and a stereoParameters object. For the uncalibrated case it takes the two images and two projective transformation objects of class projective2d.

    From what you've written it seems that your stereoParams is actually a projective transform object. In that case, rectifyStereoImages goes into the uncalibrated mode, and expects two of them.