-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtestTMC.py
38 lines (33 loc) · 1.43 KB
/
testTMC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
Author: [email protected]
LastEditors: FCY
Description: this file encodes MAT Files
FilePath: /compression/encoderTool.py
'''
import datetime,os
import pt as pointCloud
import numpy as np
###########Objct##############
from subprocess import Popen
GPCC_MULTIPLE = 1
list_orifile = ['file/Ply/2851.ply']
if __name__=="__main__":
print("****TMC V14****")
print(datetime.datetime.now().strftime('%Y-%m-%d:%H:%M:%S'))
for oriFile in list_orifile:
print(oriFile)
p = pointCloud.ptread(oriFile)
pointCloud.write_ply_data('./temp/tmc/p.ply',p*GPCC_MULTIPLE)
qstmc = 1.0
print('_'*50,'encode','_'*50)
cmd = "./file/tmc13v14_r --mode=0 -c ./file/redandblack.cfg --uncompressedDataPath=./temp/tmc/p.ply --compressedStreamPath=./temp/tmc/tmc.bin --mergeDuplicatedPoints=1 --positionBaseQp=4 --positionQuantizationScale="+str(qstmc)
Popen(cmd, shell=True).wait()
print('ptNum: ',p.shape[0])
bz = os.path.getsize('./temp/tmc/tmc.bin')*8
print('binsize(b): ',bz)
print('tmc bpip: ',bz/p.shape[0])
print('_'*50,'decode','_'*50)
cmd = "./file/tmc13v14_r --mode=1 --reconstructedDataPath=./temp/tmc/recPt.ply --compressedStreamPath=./temp/tmc/tmc.bin"
Popen(cmd, shell=True).wait()
print('_'*50,'pc_error','_'*50)
pointCloud.pcerror(p,pointCloud.ptread('./temp/tmc/recPt.ply')/GPCC_MULTIPLE,None,'-r 1023',None).wait()