%pylab inline
Populating the interactive namespace from numpy and matplotlib
from hampy import HammingMarker
marker = HammingMarker(id=206135218)
img = (1 - marker.toimage(size=180)) * 255
imshow(img, cmap='Greys', interpolation='nearest')
<matplotlib.image.AxesImage at 0x1124d8150>
marker = HammingMarker.generate()
img = (1 - marker.toimage(size=128)) * 255
imshow(img, cmap='Greys', interpolation='nearest')
<matplotlib.image.AxesImage at 0x1125cd1d0>
import cv2
from hampy import detect_markers
img = cv2.imread('../../../Desktop/1.jpg')
img = cv2.cvtColor(img, cv2.cv.CV_BGR2RGB)
imshow(img)
<matplotlib.image.AxesImage at 0x113755490>
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]
<matplotlib.image.AxesImage at 0x113df1ad0>