-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathinform_hough_on_pts.py
78 lines (61 loc) · 1.18 KB
/
inform_hough_on_pts.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Given a set of ML pruned saddle points, remove outliers or keep only chessboard area
import numpy as np
import matplotlib.pyplot as plt
pts = np.array([[237, 332],
[242, 287],
[245, 263],
[247, 360],
[249, 337],
[252, 314],
[255, 290],
[257, 389],
[258, 266],
[260, 366],
[262, 342],
[268, 294],
[271, 269],
[274, 372],
[280, 323],
[286, 272],
[286, 404],
[291, 353],
[295, 328],
[298, 302],
[298, 437],
[301, 411],
[304, 386],
[311, 333],
[318, 279],
[318, 420],
[321, 393],
[324, 366],
[329, 339],
[332, 311],
[336, 283]])
outliers = np.array([
[50,23],
[30,63],
[400,203],
[250,370],
[500,303],
])
pts = np.vstack([pts, outliers])
# plt.plot(outliers[:,0],outliers[:,1],'rx')
# plt.plot(pts[:,0],pts[:,1],'.')
# plt.show()
N = len(pts)
new_order = np.arange(N)
np.random.shuffle(new_order)
pts = pts[new_order,:]
print pts
import time
ta = time.time()
outlier = calculateOutliers(pts)
pred_outliers = pts[outlier,:]
tb = time.time()
proc_time = tb-ta
print("Processed in %.2f ms" % (proc_time*1e3))
# plt.plot(outliers[:,0],outliers[:,1],'rx')
plt.plot(pred_outliers[:,0],pred_outliers[:,1],'rx')
plt.plot(pts[:,0],pts[:,1],'.')
plt.show()