Skip to content

Instantly share code, notes, and snippets.

@michtesar
Created April 4, 2019 23:13
Show Gist options
  • Select an option

  • Save michtesar/f4c23d5b4606d19bc3a4acbfb8d54b4d to your computer and use it in GitHub Desktop.

Select an option

Save michtesar/f4c23d5b4606d19bc3a4acbfb8d54b4d to your computer and use it in GitHub Desktop.
Generate Aruco markers
import numpy as np
import cv2, PIL
from cv2 import aruco
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
aruco_dict = aruco.Dictionary_get(aruco.DICT_ARUCO_ORIGINAL)
fig = plt.figure()
nx = 4
ny = 3
for i in range(1, nx*ny+1):
ax = fig.add_subplot(ny,nx, i)
img = aruco.drawMarker(aruco_dict,i, 700)
plt.imshow(img, cmap = mpl.cm.gray, interpolation = "nearest")
ax.axis("off")
plt.savefig("markers.pdf")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment