Thursday, January 3, 2019

Try using arUco

Detect markers are easy to try, while estimate pose is a bit harder, since, by principle, it requires calibration beforehand.

I wrote some notes here as to how I did that.
What I did are the following:
  • Made one ChArUco(QRcode-like-inscribed checkerboard pattern) jpeg file.
  • Had the ChArUco image be shown on iPad and took some pictures of it with the camera to be calibrated.
  • Threw those pictures into a function to do calibration.
Unfortunately the following tutorial is too fragmented for me:
https://docs.opencv.org/3.4.5/da/d13/tutorial_aruco_calibration.html

--------
Before plunging into codes, it may be good to understand how the calibration process works using charuco.

The data output of calibration is calibration matrix and distance coefficients.
  1. Detect the Arucos in the image(s).
  2. Estimate the plane on which charuco pattern is in the image, by detected Arucos coordinate.
For above no. 1-2, see "OpenCV: Detection of ChArUco Corners":
https://docs.opencv.org/3.4.5/df/d4a/tutorial_charuco_detection.html

(Note that all opencv documentation URLs are linked to that of version 3.4.5, as it is the version I use.)

--------
First, some of my opencv environment information:
  • Python: version 3.6.4 running on Pyenv(version 1.2.8).
  • OpenCV: opencv-python version 3.4.5(installed in one of a virtual environment created by venv.)

--------
/calibrate_camera_charuco.cpp

https://docs.opencv.org/3.4.5/d5/dae/tutorial_aruco_detection.html



https://ensekitt.hatenablog.com/entry/2018/04/12/200000

The following site says we need 20 some pictures.
http://robonchu.hatenablog.com/entry/2017/08/21/151412

The following article was too fragmented for me: "OpenCV: Calibration with ArUco and ChArUco"
https://docs.opencv.org/3.4.5/da/d13/tutorial_aruco_calibration.html


So I made myself ChArUco board jpeg.


retval, cameraMatrix, distCoeffs, rvecs, tvecs = cv.aruco.calibrateCameraCharuco( charucoCorners, charucoIds, board, imageSize, cameraMatrix, distCoeffs[, rvecs[, tvecs[, flags[, criteria]]]]

documentation simply says "Board" class instance, but here we need its sub class "CharucoBoard".

--------
Other references:
http://answers.opencv.org/question/98447/camera-calibration-using-charuco-and-python/




Unstable values in ArUco pose estimation
https://stackoverflow.com/questions/51709522/unstable-values-in-aruco-pose-estimation




No comments:

Post a Comment

Writing a post in Markdown in Blogger

Following articles are helpful. * [【令和最新版】Blogger で Markdown を用いて記事を書く方法](https://qiita.com/hoge_fu-ga/items/267ea5ad4f8c120eaeb8) * [Bl...