-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (18 loc) · 727 Bytes
/
main.py
File metadata and controls
25 lines (18 loc) · 727 Bytes
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
import numpy as np
from scipy.ndimage import map_coordinates
from interpolation import interpolation_simd
def main():
height, width = 300, 400
N = 64
image = np.random.randint(0, 10, (height, width)).astype(np.float32)
xs = np.random.uniform(0, width-1, N)
ys = np.random.uniform(0, height-1, N)
intensities_true = map_coordinates(image, np.vstack((ys, xs)), order=1)
C = np.column_stack((xs, ys)).astype(np.float32)
intensities_pred = interpolation_simd(image, C)
assert(len(intensities_pred) == len(intensities_true))
for i in range(len(intensities_true)):
print("true {:.3f} pred {:.3f}".format(
intensities_true[i], intensities_pred[i]
))
main()