In [1]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [ ]:
from hampy import HammingMarker

marker = HammingMarker(id=206135218)
img = (1 - marker.toimage(size=180)) * 255
In [3]:
imshow(img, cmap='Greys', interpolation='nearest')
Out[3]:
<matplotlib.image.AxesImage at 0x1124d8150>
In [4]:
marker = HammingMarker.generate()
img = (1 - marker.toimage(size=128)) * 255

imshow(img, cmap='Greys', interpolation='nearest')
Out[4]:
<matplotlib.image.AxesImage at 0x1125cd1d0>
In [5]:
import cv2

from hampy import detect_markers

img = cv2.imread('../../../Desktop/1.jpg')
img = cv2.cvtColor(img, cv2.cv.CV_BGR2RGB)
imshow(img)
Out[5]:
<matplotlib.image.AxesImage at 0x113755490>
In [6]:
markers = detect_markers(img)

for m in markers:
    print 'Found marker {} at {}'.format(m.id, m.center)
    m.draw_contour(img)
    
imshow(img)
Found marker 157557867 at [ 840.75  423.75]
Out[6]:
<matplotlib.image.AxesImage at 0x113df1ad0>
In [ ]: