-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathtest_numpy.py
More file actions
27 lines (25 loc) · 744 Bytes
/
Copy pathtest_numpy.py
File metadata and controls
27 lines (25 loc) · 744 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
26
27
#!/usr/bin/python
from math import sin, cos, pi
import numpy
import matplotlib
from matplotlib import pylab
import scipy
import feature
l = scipy.misc.lena().astype(numpy.float32)
fig = pylab.figure()
sp = fig.add_subplot(1, 1, 1)
sp.imshow(l, interpolation="nearest", cmap="gray")
siftalignement = feature.SiftAlignment()
kp = siftalignement.sift(l)
print kp[:, :4]
print kp[:, :4].max(axis=0)
print kp.shape[0]
for i in range(kp.shape[0]):
x = kp[i, 0]
y = kp[i, 1]
scale = kp[i, 2]
angle = kp[i, 3]
sp.annotate("", xy=(x, y), xytext=(x + scale * cos(angle), y + scale * sin(angle)), color="blue",
arrowprops=dict(facecolor='blue', edgecolor='blue', width=1),)
fig.show()
raw_input("enter to quit")