【发布时间】:2015-11-03 00:34:15
【问题描述】:
这是我第一次做图像处理。所以我有很多问题: 我有两张从不同位置拍摄的照片,一张从左侧拍摄,另一张从右侧拍摄,如下图所示。[![在此处输入图像描述][1]][1]
第一步:使用imread函数读取图片
I1 = imread('DSC01063.jpg');
I2 = imread('DSC01064.jpg');
第二步:在matlab中使用camera calibrator app获取cameraParameters
load cameraParams.mat
第 3 步:使用 undistortImage 函数去除镜头失真
[I1, newOrigin1] = undistortImage(I1, cameraParams, 'OutputView', 'same');
[I2, newOrigin2] = undistortImage(I2, cameraParams, 'OutputView', 'same');
第四步:使用detectSURFFeatures函数检测特征点
imagePoints1 = detectSURFFeatures(rgb2gray(I1), 'MetricThreshold', 600);
imagePoints2 = detectSURFFeatures(rgb2gray(I2), 'MetricThreshold', 600);
第 5 步:使用 extractFeatures 函数提取特征描述符
features1 = extractFeatures(rgb2gray(I1), imagePoints1);
features2 = extractFeatures(rgb2gray(I2), imagePoints2);
第 6 步:使用 matchFeatures 函数匹配特征
indexPairs = matchFeatures(features1, features2, 'MaxRatio', 1);
matchedPoints1 = imagePoints1(indexPairs(:, 1));
matchedPoints2 = imagePoints2(indexPairs(:, 2));
从那里,我如何构建 3D 点云??? 在第 2 步中,我使用图片附件中的棋盘格来校准相机[![在此处输入图像描述][ 2]][2]
正方形大小为 23 毫米,从 cameraParams.mat 我知道内部矩阵(或相机校准矩阵 K),其形式为 K=[alphax 0 x0; 0阿尔法y0; 0 0 1]。
为了计算相机矩阵 P1 和 P2,我需要计算基本矩阵 F、基本矩阵 E,对吧???
之后,当我拥有相机矩阵 P1 和 P2 时,我使用线性三角测量方法来估计 3D 点云。 方法对吗?
如果您对我有任何建议,我将不胜感激?
谢谢!
【问题讨论】:
-
对不起!我无法发布图片。
-
如果将
undistortImage的OutputView参数设置为same,那么newOrigin就不用管了,因为它是[0 0]。 -
@TRITRAN,您的代码是否可以使用 2 张图片?如果可以,请给我完整的代码,我的项目需要它,它是完成它所需的最后一部分,谢谢
标签: matlab computer-vision matlab-cvst 3d-reconstruction