- Import the modules:
import cv2import matplotlib.pyplot as plt
- Load the test image with a chessboard:
image_chess = cv2.imread('../data/chessboard.png')
- Detect the chessboard pattern:
found, corners = cv2.findChessboardCorners(image_chess, (6, 9))assert found == True, "can't find chessboard pattern"
- Draw the detected pattern:
dbg_image_chess = image_chess.copy()cv2.drawChessboardCorners(dbg_image_chess, (6, 9), corners, found);
- Load the test image with a circle grid pattern:
image_circles = cv2.imread('../data/circlesgrid.png')
- Detect the circle grid pattern:
found, corners = cv2.findCirclesGrid(image_circles, (6, 6), cv2.CALIB_CB_SYMMETRIC_GRID)assert found == True, "can't find circles grid pattern"
- Draw the detected ...