【发布时间】:2015-04-15 20:47:47
【问题描述】:
我想校正两个摄像机拍摄的两个立体图像。我想使用 MATLAB 函数 rectifyStereoImages 进行校正:
我的问题是我使用stereoCameraCalibrator 计算的stereoParams 不被该函数接受:
[J1,J2] = rectifyStereoImages(I1,I2, stereoParams)
这里是sn-p的代码:
imPath1 = 'Webcam1_00001.jpg';
imPath2 = 'Webcam2_00001.jpg';
imW1 = imread(imPath1);
imW2 = imread(imPath2);
load stereoParams.mat;
[I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams);
运行这会导致输出:
尝试将 SCRIPT rectifyStereoImages 作为函数执行: /home/.../rectifyStereoImages.m
rectifyStereoImages 中的错误(第 8 行) [I1, I2] = rectifyStereoImages(imW1, imW2, stereoParams);
我认为加载的变量 stereoParams 没问题,但我看不出问题出在哪里。
希望你有一些想法。
提前致谢!
【问题讨论】:
-
你有什么版本的 MATLAB?另外,当您在命令提示符下输入
which rectifyStereoImages时会发生什么?你在屏幕上看到了什么? -
dasdadasda > which rectifyStereoImages 结果到:/home/..../rectifyStereoImages.m。我创建的 m 文件。现在我将名称更改为 rectifyStereoPhotos.m 运行返回没有问题,但是出现警告并且校正后的输出图像是黑色的?你知道为什么它会导致黑色图像吗?这是警告:
-
警告:未失真的图像可能包含无效像素。这可能是由于校准不准确造成的。尝试使用更多图像进行校准,使校准图案覆盖大部分视野。> 在 cameraParameters>cameraParameters.getValidBounds 在 1004 在 cameraParameters>cameraParameters.computeUndistortBounds 在 930 在 stereoParameters>stereoParameters.computeOutputBounds 在 607 在 stereoParameters>stereoParameters.computeRectificationParameters在 508 在 stereoParameters>stereoParameters.rectifyStereoImagesImpl 在 260 在 rectifyStereoImages 在 99 在 rectifyStereoPhotos 在 8
-
MATLAB 版本:R2014b (8.4.0.150421),64 位,2014 年 9 月 15 日
-
按“编辑”并更新您的问题,不要在 cmets 中添加此信息。问题,现在您已经解决了文件名问题,更有可能是您如何进行校准,但请检查输出图像的
type和max/min值,以防出现缩放问题。跨度>
标签: matlab matlab-cvst