(Matlab)structure-from-motion-from-multiple-views复现踩坑!

(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维零向量
 

踩坑中……  后续出现问题继续更新!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值