在matlab中的两个补丁之间画一条3D线

Draw a 3D line between two patches in matlab

我有两组坐标,形式如下:

v= (x1 y1 z1 a1 b1 c1,
    x2 y2 z2 a2 b2 c2,
    ....,
    xn yn zn an bn cn)

这些是两个网格的顶点坐标。我想绘制一条 3D 线,将 mesh1 中的顶点连接到 mesh2 中的相应顶点。我正在使用 patch 函数来显示两个网格。我尝试了 plot3,它似乎只在单个网格中连接点之间的线。

代码:

% vertex_coordinates contains vertices of matched keypoints obtained using index. Taking first 50 coordinates from the 2 meshes
v=[vertex_coordinates1(1:50,:), vertex_coordinates0(1:50,:)];
x=[v(:,1) v(:,4)];
y=[v(:,2) v(:,5)];
z=[v(:,3) v(:,6)];

figure
p0 = patch('Faces',faces0,'Vertices',vertex0,'FaceColor','blue','FaceAlpha',.5,'edgecolor', 'none');
p1 = patch('Faces',faces1,'Vertices',vertex1,'FaceColor','red','FaceAlpha',.2,'edgecolor', 'none');
axis equal off
hold on
plot3(x',y',z')

我得到的结果类似于下图。 我想要这样的东西。

这些坐标实际上是两个网格中匹配的关键点的顶点。我使用匹配项的索引来获取坐标并在它们之间画一条线。我的代码有问题吗?或者我应该考虑对我的比赛进行阈值处理吗?

经过仔细研究,我发现我的比赛中有很多异常值。在匹配的关键点坐标上执行 RANSAC 后,我能够得到一些还不错的输出。

帮我画火柴的代码如下。

v=[best_match_query, best_match_test];
x=[v(:,1), v(:,4)];
y=[v(:,2), v(:,5)];
z=[v(:,3), v(:,6)];
figure
p0 = patch('Faces',faces0,'Vertices',vertex0,'FaceColor','blue','FaceAlpha',.5,'edgecolor', 'none');
p1 = patch('Faces',faces1,'Vertices',vertex1,'FaceColor','red','FaceAlpha',.2,'edgecolor', 'none');
legend('template', 'test')
axis equal off
hold on
plot3(x',y',z')
view(0,90)