Problem with rectify StereoImages

조회 수: 9 (최근 30일)
MJ MJ
MJ MJ 2015년 7월 30일
답변: David 2022년 10월 17일
I want to do a 3D reconstruction from two images from the same camera. I used the Stereo Camera Calibrator App on Matlab R2015a in order to calibrate the camera. The calibration seems to work fine :
Then I used the example from the help to do the 3D reconstruction.
load('Param_test8.mat') % loads the camera parameters
% Read in the stereo pair of images.
I1 = imread('Cam1/Camera1_img1.tif');
I2 = imread('Cam2/Camera2_img1.tif');
% Rectify the images.
[J1, J2] = rectifyStereoImages(I1, I2, stereoParams,'cubic','OutputView','full');
However, there is a problem when I run the rectifyStereoImages, since the two images are then positioned very far from each other :
I don't understand where the problem is, since the stereo calibration manages to position the cameras and the checkerboards very well. I tried different positions for the camera, and different images to reconstruct, but I don't know where the problem is.
  댓글 수: 2
Dima Lisin
Dima Lisin 2015년 7월 30일
What happens if you press "Show Rectified" button in the Stereo Camera Calibrator app? Also, your reprojection errors are rather high. Generally, you want the mean error to be less than .5 of a pixel. It would help if you take more calibration images.
MJ MJ
MJ MJ 2015년 7월 30일
When I press the button the following error shows :
Index exceeds matrix dimensions.
Error in vision.internal.calibration.CameraParametersImpl/getValidBounds (line 860)
boundaryPixelsUndistorted = boundaryPixelsUndistorted(:, [2,1]);
Error in vision.internal.calibration.CameraParametersImpl/computeUndistortBounds (line 785)
[xBounds, yBounds] = getValidBounds(this, undistortedMask, ...
Error in vision.internal.calibration.StereoParametersImpl/computeOutputBounds (line 377)
[xBoundsUndistort2, yBoundsUndistort2] = ...
Error in vision.internal.calibration.StereoParametersImpl/computeRectificationParameters (line 271)
[xBounds, yBounds] = computeOutputBounds(this, imageSize, ...
Error in vision.internal.calibration.StereoParametersImpl/rectifyStereoImagesImpl (line 190)
[H1, H2, Q, xBounds, yBounds] = ...
Error in rectifyStereoImages (line 99)
[rectifiedImage1, rectifiedImage2] = rectifyStereoImagesImpl(stereoParams, ...
Error in vision.internal.calibration.tool.StereoCalibrationImageDisplay/drawRectifiedImages (line 207)
[I1, I2] = rectifyStereoImages(I1, I2, stereoParams);
Error in vision.internal.calibration.tool.StereoCalibrationImageDisplay/drawBoard/drawRectifiedImagesCallback (line 71)
drawRectifiedImages(this, board, stereoParams);
Error in vision.internal.calibration.tool.ToggleButton/onPush (line 49)
this.PushedFcn();
Error in vision.internal.calibration.tool.ToggleButton>@(varargin)this.onPush(varargin{:}) (line 24)
'Tag', this.Tag, 'Callback', @this.onPush);
Error while evaluating UIControl Callback
I tried to add more images, but the error is still more than 1px, do you have any idea why that could be ? Thank your for your help

댓글을 달려면 로그인하십시오.

답변 (7개)

Babak Zandi
Babak Zandi 2020년 1월 21일
편집: Babak Zandi 2020년 1월 21일
Did anyone solve this issue?

Dima Lisin
Dima Lisin 2015년 7월 31일
The error you are getting indicates a problem with calibration. rectifyStereoImages cannot compute the size of the rectified images, because the undistorted image gets folded upon itself. You definitely need more calibration images. Please be sure to get the checkerboard close to the edges and corners of the image, to get a better estimate of the distortion. Also, are you using 3 coefficients for radial distortion? If you are, then try using 2 instead.
  댓글 수: 2
MJ MJ
MJ MJ 2015년 8월 4일
Thank you for your help. I tried to take more images, now there is no more error when I hit "ShowRectify", however the result seems strange. Besides I still have the same problem as before for rectifyimagestereo function.
Dima Lisin
Dima Lisin 2015년 8월 6일
Can you move your cameras closer together to get more overlap of the field of view? If not, then you can try doing sparse reconstruction using the triangulate function, without having to rectify the images.

댓글을 달려면 로그인하십시오.


Wei Zhao
Wei Zhao 2016년 7월 5일
Hi, i have the same Problem, have you solved it?

Wei Zhao
Wei Zhao 2016년 7월 5일

Alois Sing
Alois Sing 2017년 5월 11일
편집: Alois Sing 2017년 5월 11일

Hi, i have the same problem I cant move the cameras closer together, because i want a low distance error. I have 54 pictures of calibration pattern and the mean error is 0.1 pixel. The focal length is with around 150mm really high, because of the low distance error. It seems, that the problem is the function rectifyStereoImages.

If the outputview is "full" it shows the hole picture and the rectification is still good, but there is a big black space on each picture. calculating the disparity from this pictures is still hard and the result is really bad. On the picture below you can see the rectified pictures with horizontal lines witch shows, that the rectification process is still working.

and this is the best result from the disparity and the reconstructScene. The depth is too far away and a lot of points are on a plane.

If the outputview is "valid" it just shows the region, wich overlaps at infinity. You can see that on the left in the next picture, on the right is the "full" picture with the surroundet region wich is the output of "valid".

Can anybody help me with this problem ? Or has a hint for calculating the disparity from the "full" pictures.


kevin pierce
kevin pierce 2018년 8월 8일
Same problem for me !

David
David 2022년 10월 17일
I have the same problem, some solved this?

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by