Open3D-PointNet2-Semantic3D・マスタ動作

1.修正download_semantic3d.shファイル

#!/ binに/ bashの

ANS = `dpkgのクエリ-W p7zip- full`
 であれば [-z " $ ANS " ]; その後、
    エコー" :sudoのp7zipのフルインストールapt-getを実行してp7zipのフルをインストールしてください" 
    の出口を - 1 
Fiの

ための`猫semantic3D_files.csv`
 DO 
    output_fileは = `ベース名$ i` 
    エコーのダウンロード$ {output_fileは} .. 。
    #把wgetの$ I改成:wgetの -c - N $ I 
    のwget -c - N $ I 
    7Z X {}のoutput_file $ - Y 
完了

MV station1_xyz_intensity_rgb.txt neugasse_station1_xyz_intensity_rgb.txt 

終了0

2.修正ファイルpreprocess.py

インポートOS
 インポートサブプロセス
 インポートshutil
 インポートは、Open3D 

から dataset.semantic_dataset インポートall_file_prefixes 


DEF WC(FILE_NAME):
    アウト = subprocess.Popen(
        [ " WC "" -l "、ファイル名]、STDOUT = subprocess.PIPE、標準エラー= subprocess.STDOUT 
    ).communicate()[0]に
    戻り INT(out.partition(B "  " )[0])


DEF prepend_line(FILE_NAME、ライン): オープンFILE_NAMEと、R +" )Fとして:
        コンテンツ = f.read()
        f.seek(0、0)
        f.write(line.rstrip(" \ R \ n ")+ " \ n " + コンテンツ)


デフpoint_cloud_txt_to_pcd(raw_dir、FILE_PREFIX) :
     ファイル名 
    txt_file = os.path.join(raw_dir、FILE_PREFIX + " .TXT " 
    pts_file = os.path.join(raw_dir、FILE_PREFIX + " .pts " 
    pcd_file = os.path.join(raw_dir、FILE_PREFIX + " .PCD " 

    すでに行われた場合にスキップする
    場合os.path.isfile(pcd_file):
         プリント" PCDは{}が存在し、スキップ" .format(pcd_file))
         リターン

    #の.ptsに.TXT 
    私達はちょうど行数を付加でき、しかし、がありますいくつかの強度値
    非整数です。
    印刷" [txt-> PTS] " 、印刷" :TXT {} " .format(txt_file))
     プリント" :{} PTS " .format(pts_file))
    オープン(txt_fileと" R ")txt_fとして、(pts_file、オープン" W " pts_fなど)
         のためのラインtxt_f:
            X、Y、Z、I、R、G、B 
            のトークン= line.split()
            トークン[ 3] = STR(INT(フロート(トークン[3 ]))) = "  " .join(トークン)
            pts_f.write(ライン + " \ n " 
    prepend_line(pts_file、STR(WC(txt_file)))

    #1 .pts - > .PCD 
    プリント" [PTS-> PCD] " 印刷"PTS:{} " .format(pts_file))
     プリント" PCD:{} " .format(pcd_file))
     """ 
    point_cloud = open3d.read_point_cloud(pts_file)
    open3d.write_point_cloud(pcd_file、point_cloud)
    改成:
    point_cloud =は、Open3D .io.read_point_cloud(pts_file)
    open3d.io.write_point_cloud(pcd_file、point_cloud)
    ""」
    point_cloud = open3d.io.read_point_cloud(pts_file)
    open3d.io.write_point_cloud(pcd_file、point_cloud)
    os.remove(pts_file)


場合 __name__ == " __main__ " デフォルトでは
    "データセット/ semantic_raw":生データ 
    current_dir = os.path.dirname(os.path.realpath(__FILE__ ))
    dataset_dir = os.path.join(current_dir、" データセット" 
    raw_dir = os.path.join( dataset_dir、" semantic_raw " 

    のための FILE_PREFIX all_file_prefixes:
        point_cloud_txt_to_pcd(raw_dir、FILE_PREFIX)

 

 

 

 

 

 

 

 

 

おすすめ

転載: www.cnblogs.com/yibeimingyue/p/11908630.html