-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.py
49 lines (39 loc) · 1.06 KB
/
main_test.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
39
40
41
42
43
44
45
46
47
48
49
import numpy as np
import requests
import tarfile
from registration_utils import read_point_cloud_from_ply_file, align
from ssim_utils import pc_ssim
NUM_POINTS = 10000
url = 'http://graphics.stanford.edu/pub/3Dscanrep/bunny.tar.gz'
target_path = 'bunny.tar.gz'
response = requests.get(url, stream=True)
if response.status_code == 200:
with open(target_path, 'wb') as f:
f.write(response.raw.read())
my_tar = tarfile.open(target_path)
my_tar.extractall('.')
my_tar.close()
pcA = read_point_cloud_from_ply_file(
"bunny/data/bun000.ply",
num_points=NUM_POINTS,
outlier_removal=False,
)
pcB = read_point_cloud_from_ply_file(
"bunny/data/bun045.ply",
num_points=NUM_POINTS,
outlier_removal=False,
)
pcA.estimate_normals()
pcB.estimate_normals()
pcB = align(pcB, pcA)
score = pc_ssim(
pcA,
pcB,
neighborhood_size=12,
feature="curvature",
ref=0,
estimators=["std", "var", "mean_ad", "median_ad", "coef_var", "qcd"],
pooling_methods=["mean", "mse", "rms"],
const=np.finfo(float).eps,
)
print(score)