我有两组坐标的形式:
v= (x1 y1 z1 a1 b1 c1,
x2 y2 z2 a2 b2 c2,
....,
xn yn zn an bn cn)
这些是来自两个网格的顶点坐标。我想绘制一条 3D 线,将网格 1 中的顶点连接到网格 2 中的相应顶点。我正在使用该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)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句