(Matlab版本为MATLABR2018b)
1. 错误一:未定义变量或函数helperEstimateRelativePose()
处理方法:此函数对应的.m文件在目录D:\Program Files (x86)\MATLAB\R2018b\examples\vision\main中将此文件拷贝某一英文目录下,并添加此路径即可。
2.错误二:Match index exceeds the number of points
处理方法:
调试中发现:
max(matches(:,2))=
uint32
46782
max(matches(:,1)) =
uint32
47539
points1 =
1×1 cell 数组
{47588×2 single}
points2 =
1×1 cell 数组
{46800×2 single}
将代码:
areMatchesOutOfBounds = max(matches(:, 1)) > size(points1, 1) || ...
max(matches(:, 2)) > size(points2, 1);
修改为:areMatchesOutOfBounds = max(matches(:, 1)) > size(points1{1}, 1) || ...
max(matches(:, 2)) > size(points2{1}, 1);
问题解决!
1. 错误三:
未定义与 'cell' 类型的输入参数相对应的运算符 '*'。
出错 SFM_test (line 76)
orientation = relativeOrient * prevOrientation;
原因:relativeOrient =
0.9903 -0.0994 0.0967
0.0994 0.9950 0.0047
-0.0967 0.0049 0.9953
prevOrientation =
1×1 cell 数组
{0×0 double}
解决方法:
orientation = relativeOrient * prevOrientation;
修改为:orientation = relativeOrient * prevOrientation{1};
修改后问题还没有解决:
错误使用 *
用于矩阵乘法的维度不正确。请检查并确保第一个矩阵中的列数与第二个矩阵中的行数匹配。要执行按元素相乘,请使用 '.*'。
出错 SFM_test (line 76)
orientation = relativeOrient * prevOrientation{1};
还需要将:
vSet = addView(vSet,1, 'Points', currPoints);修改为
vSet = addView(vSet, 1, 'Points', prevPoints, 'Orientation', ...
eye(3, 'like', prevPoints.Location), 'Location', ...
zeros(1, 3, 'like', prevPoints.Location));
注意:以第一帧为世界坐标,第一帧的旋转和平移要初始化为3*3单位阵和3维零向量