计算的法线与形状网数据集的给定不匹配

问题描述

我正在计算shapenet数据集的法线[我想稍后再添加新类],我发现计算出的法线与数据集中给定的法线不匹配。我已使用以下代码计算法线-- >

#!/usr/bin/env python
import sys
import numpy as np
import open3d as o3d 
import glob

src_dir = "/shapenetcore_partanno_segmentation_benchmark_v0_normal/02691156/*.txt"

def main():
    fl_list = glob.glob(src_dir)
    count = match = 0
    for f in fl_list:
        fp  = np.loadtxt(f).astype(np.float32)
        xyz = fp[:,:3] #XYZ coordinates 
        xyz_nor = fp[:,3:6] #normals of XYZ coordinates 
        label   = fp[:,:-1] #labels
        pcd  =  o3d.geometry.PointCloud() 
        pcd.points = o3d.utility.Vector3dVector(xyz)
        pcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1,max_nn=5));o3d.geometry.PointCloud.orient_normals_to_align_with_direction(pcd,orientation_reference=np.array([0.,0.,1.]))
        count = count + 1
        comparison = pcd.normals == xyz_nor
        if comparison.all():
            print(f"Normals match for file {f}")
            match = match + 1
        
    print(f"Match {match/count}%")

if __name__ == "__main__":
    main()`

我已使用脚本Shapenet Dataset

下载了数据集

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...