【问题标题】:How to combine rows from different matrices [duplicate]如何组合来自不同矩阵的行[重复]
【发布时间】:2020-04-10 17:34:57
【问题描述】:

我校准了十张图片,得到了它的平移向量和旋转向量。

V = cameraParams.TranslationVectors (3X10) 
R = cameraParams.RotationVectors; (3X10)

我如何分配十个 [1x6] 矩阵,方法是从 V 中取三个,从 R 中取 3 个(各自的图像)来分配所有十个分量。

例子:

V = 
1 2 3 
4 5 6
7 8 9
. . .
. . .

R = 
11 12 13 
14 15 16
17 18 19
.  .  .
.  .  .

Final = 
1 2 3 11 12 13
4 5 6 14 15 16
. . .  .  .  .  
. . .  .  .  .
V = cameraParams.TranslationVectors
V(:,1) %Reading 1st row
A(1) gives the first value

但我怎样才能有效地做到这一点呢?

【问题讨论】:

    标签: matlab matrix vector camera-calibration rotational-matrices


    【解决方案1】:

    你想要的是Concatenate arrays horizontally。可以使用以下方法之一完成:

    Final = [V, R]
    Final = [V R]
    Final = horzcat(V, R)
    Final = cat(2, V, R)    % Concatenate along the second dimension
    

    第一个是最常见的。对于不习惯 MATLAB 语法的人来说,第三个可能最容易阅读。第四种方法通常仅在您想沿维度3 ... N 连接矩阵时使用,即不是水平或垂直。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-08
      • 1970-01-01
      • 1970-01-01
      • 2012-04-27
      • 2021-10-19
      • 2018-09-20
      • 1970-01-01
      相关资源
      最近更新 更多