opencv: cv2.aruco.calibrateCameraCharuco does not exist

System Information

OpenCV python version: 4.7.0 Operating System / Platform: Ubuntu 22.04 Python version: 3.10

Detailed description

I am working on calibrating a camera with a Charuco board. I ported my pre-OpenCV 4.5 code to 4.7 now, but I am stuck at actually calibrating the camera using the detected points since a necessary function is apparently not included in the generated python bindings:

Traceback (most recent call last):
  File "/home/fe/korjakow/Projects/intrinsic_calibrator/install/camera_calibration/lib/python3.10/site-packages/camera_calibration/camera_calibrator.py", line 278, in on_mouse
    self.c.do_calibration()
  File "/home/fe/korjakow/Projects/intrinsic_calibrator/install/camera_calibration/lib/python3.10/site-packages/camera_calibration/calibrator.py", line 1017, in do_calibration
    self.cal_fromcorners(self.good_corners)
  File "/home/fe/korjakow/Projects/intrinsic_calibrator/install/camera_calibration/lib/python3.10/site-packages/camera_calibration/calibrator.py", line 774, in cal_fromcorners
    reproj_err, self.intrinsics, self.distortion, rvecs, tvecs = cv2.aruco.calibrateCameraCharuco(
AttributeError: module 'cv2.aruco' has no attribute 'calibrateCameraCharuco'

According to the docs the function should exist though: https://docs.opencv.org/4.7.0/d4/d17/namespacecv_1_1aruco.html

Would it be possible to add it back in?

Steps to reproduce

import cv2
cv2.aruco.calibrateCameraCharuco(None, None, None, None, None, None)

Issue submission checklist

  • I report the issue, it’s not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 19 (5 by maintainers)

Most upvoted comments

It’s honestly infuriating how there is zero documentation for an unnecessary change that breaks every single tutorial or reference out there to date! One should not have to dig through an obscure GitHub commit line by line to figure out what the new method is called or where it spirited off to. There’s another issue that’s been open for quite a while as well about how this change also silently breaks calibration for every even-rowed ChAruco board.

What happened to backwards compatibility?

And now there’s a function that isn’t just renamed or moved, but simply doesn’t exist anymore, and one needs to entirely uninstall and reinstall another version of OpenCV to get around it? Come on.

I am confused as to why this issue was closed? It seems that the cv2.aruco.calibrateCameraCharuco function is still missing from OpenCV 4.7.0. I have tested this with both the opencv==4.7.0 and opencv-contrib-python==4.7.0.72 packages and it is not available in either.

What is the recommended way to acess this function? It should not appear in official documentation and tutorials if it is not available.

I haven’t got this problem :

>>> cv.aruco.calibrateCameraCharuco
<built-in function calibrateCameraCharuco>
>>> help(cv.aruco.calibrateCameraCharuco)
Help on built-in function calibrateCameraCharuco:

calibrateCameraCharuco(...)
    calibrateCameraCharuco(charucoCorners, charucoIds, board, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
    .   * @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.

Can you insert cv.getBuildinformation()?

PS you must not install opencv and opencv_contrib only opencv_contrib

I haven’t got this problem :

>>> cv.aruco.calibrateCameraCharuco
<built-in function calibrateCameraCharuco>
>>> help(cv.aruco.calibrateCameraCharuco)
Help on built-in function calibrateCameraCharuco:

calibrateCameraCharuco(...)
    calibrateCameraCharuco(charucoCorners, charucoIds, board, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]) -> retval, cameraMatrix, distCoeffs, rvecs, tvecs
    .   * @brief It's the same function as #calibrateCameraCharuco but without calibration error estimation.

Can you insert cv.getBuildinformation()?

PS you must not install opencv and opencv_contrib only opencv_contrib

This also fixed the problem for me.