フィルターのクリア

Problem with rectify StereoImages

22 ビュー (過去 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 Center および File ExchangeMATLAB 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