EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
557 stars 175 forks source link

Question // CameraCalibration #131

Open wearenocomputer opened 2 years ago

wearenocomputer commented 2 years ago

Hi everybody,

This is more of a question than an issue actually. I am looking at the ArucoCameraCalibration example. I am not using Aruco markers but a traditional chessboard. When creating the object points this extra bit of code is used.

(ArUcoCameraCalibrationExample.cs - line 729)

float[] tlPt = new float[3]; // top-left point objectPoint.get(0, 0, tlPt); float[] trPt = new float[3]; // top-right point objectPoint.get((int)patternSize.width - 1, 0, trPt); trPt[0] = tlPt[0] + grid_width; objectPoint.put((int)patternSize.width - 1, 0, trPt);

It takes only the top right point and changes the value to the grid_width not counting from 0. Does anybody know why this is done?

Thank you so much in advance.

EnoxSoftware commented 2 years ago

Maybe this is the answer.

Note If your calibration board is inaccurate, unmeasured, roughly planar targets (Checkerboard patterns on paper using off-the-shelf printers are the most convenient calibration targets and most of them are not accurate enough.), a method from [231] can be utilized to dramatically improve the accuracies of the estimated camera intrinsic parameters. This new calibration method will be called if command line parameter -d= is provided. In the above code snippet, grid_width is actually the value set by -d=. It's the measured distance between top-left (0, 0, 0) and top-right (s.squareSize*(s.boardSize.width-1), 0, 0) corners of the pattern grid points. It should be measured precisely with rulers or vernier calipers. After calibration, newObjPoints will be updated with refined 3D coordinates of object points.

https://docs.opencv.org/4.x/d4/d94/tutorial_camera_calibration.html#:~:text=Note,of%20object%20points.