在 PyMeshLab 中使用数组选择顶点

问题描述 投票:0回答:1

我最近开始处理 3D 对象,从 3D 扫描仪获取的文件开始。我想为我的同事自动执行交易量计算(以及其他一些指标),否则会变得太耗时。

在脚本中,使用 pymeshlab 读取原始输出文件 (.stl),使用 KMeans 聚类进行分割、排序(从左上到右下)并进一步处理。对于分割,我目前有一个包含不同项目的顶点的数组(用“true/false”或数字(例如 1-n)表示)。我现在想使用“

compute_selection_by_condition_per_vertex
”,如此处所示(How to select an array of vertice in pymeshlab?),但条件是应选择并删除不在数组中的所有 vi(顶点索引)(使用“
m.meshing_remove_selected_vertices()
”)。问题是我似乎没有得到正确的条件。

# Compiling array containing the indices of the vertices of a cluster (tria)
vi_tria = []
    for tria_i,tria_x in enumerate(df['cluster']):
        if tria_x != 1:
            vi_tria.append(tria_i)

# Selecting the vertices in the loaded/selected mesh (tot_mesh) using the array of indices
tot_mesh.compute_selection_by_condition_per_vertex(condselect= "vi==vi_tria")

运行此程序时,出现错误:

pymeshlab.pmeshlab.PyMeshLabException:无法应用过滤器: compute_selection_by_condition_per_vertex 详细信息:意外标记 在位置 4 处找到“[]”。

我也尝试将其放入 for 循环中,但随后 PyCharm 崩溃了,我在互联网上的其他地方找不到解决方案(经过相当多的搜索后)。任何关于如何继续仅使用网格的一部分来执行表面重建(因为网格中会有一个洞)的帮助将不胜感激!

vertices pymeshlab
1个回答
0
投票

问题解决了吗?我遇到了同样的问题哈哈

© www.soinside.com 2019 - 2024. All rights reserved.