-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
41 lines (30 loc) · 863 Bytes
/
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
import numpy as np
import example.example as eb
import copy
# Read from c++
a = eb.read_image("test.png")
print('init a: 0x%x' % id(a))
eb.show_image(a) # work
# # Check continuous problem from old version
# b = a[:, :, 0]
# eb.show_image(b) # work no more continous problem
# print('diff b: 0x%x' % id(b))
# c = copy.deepcopy(b)
# eb.show_image(c) # still works
# print('diff c: 0x%x' % id(c))
# # Proves that it's still the same thing
# d = eb.passthru(a)
# print('same d: 0x%x' % id(b))
# # Make a copy
# e = eb.clone(d)
# print('diff e: 0x%x' % id(e))
# # different allocator
# f = np.zeros(shape=(100, 100), dtype=np.uint8)
# print('\ninit e: 0x%x' % id(f))
# g = eb.passthru(f)
# print('same f: 0x%x' % id(g))
# # example of class
# my_class = eb.AddClass(1)
# h = my_class.add(f)
# print(f[0, 0]) # expected 0
# print(h[0, 0]) # expected 1