How to do it...

  1. Import the modules:
import cv2import cv2.aruco as arucoimport numpy as np
  1. Create an image with different AruCo markers, blur it, and then display it:
aruco_dict = aruco.getPredefinedDictionary(aruco.DICT_6X6_250)img = np.full((700, 700), 255, np.uint8)img[100:300, 100:300] = aruco.drawMarker(aruco_dict, 2, 200)img[100:300, 400:600] = aruco.drawMarker(aruco_dict, 76, 200)img[400:600, 100:300] = aruco.drawMarker(aruco_dict, 42, 200)img[400:600, 400:600] = aruco.drawMarker(aruco_dict, 123, 200)img = cv2.GaussianBlur(img, (11, 11), 0)cv2.imshow('Created AruCo markers', img)cv2.waitKey(0)cv2.destroyAllWindows()
  1. Detect the markers on the blurred image. Draw the detected markers and display the results:
aruco_dict = aruco.getPredefinedDictionary(aruco.DICT_6X6_250) ...

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.