Detecting AruCo patterns for AR applications
Understanding a camera's position in a surrounding 3D space is a very challenging and hard-to-solve task. Specifically designed patterns, named AruCo markers, are called up to solve this issue. Each marker has enough information to determine the camera position, and also contains information about itself; so it's possible to distinguish between different markers, and, through that, understand the scene. In this recipe, we will review how to create and detect AruCo markers with OpenCV.
Getting ready
Before you proceed with this recipe, you will need to install the OpenCV 3.x Python API package with the OpenCV contrib modules.
How to do it...
- Import the modules:
import cv2 import cv2.aruco as aruco import numpy as np
- 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...