Search code examples
opencvcalibrationaruco

Camera calibration at image corners


I'm using OpenCV and working on calibrating a camera, testing a charuco-type calibrator for the first time.

I had many expectations about this calibrator, thinking with it I could get much closer to the corners of the image than with a standard chessboard, since charuco does not need to be seen entirely. This should in theory help the modeling of the projective system, as the optical deformations are greater in the corners.

The results I get leave me a little puzzled though. The interpolateCharucoCorners function, never returns me the last row/column of the chessboard, making it impossible to use those areas of the image for calibration.

Just to give you an idea I enclose the following image, where I highlighted the area described by the points extracted by interpolateCharucoCorners (the area is the convex hull of the whole set of points).

Charuco Board:

Charuco Board

As you can see the last column to the right of markers has not been extracted. Can you help me explain why? How do I include those pixels in the calibration? ChArUco corners are extracted as follows.

That's my code, but it's the same as in the example:

image_grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
corners, ids, rejected_points = cv2.aruco.detectMarkers(image_grayscale, board.dictionary)
_, charuco_corners, charuco_ids = cv2.aruco.interpolateCornersCharuco(corners, ids, image_grayscale, board)

Solution

  • I finally found the solution. The markers near the edge can be extracted by setting the parameter minMarkers = 0 in interpolateCornersChaurco. From docs:

    MinMarkers: number of adjacent markers that must be detected to return a charuco corner.

    https://docs.opencv.org/3.4/d9/d6a/group__aruco.html#gadcc5dc30c9ad33dcf839e84e8638dcd1

    This is the resulting image:

    enter image description here