1. Obtain monocular pinhole camera data
Select Camera Calibrator in the APP, as follows:
Click Add Images to import photos. It is enough to calibrate about 20 images, and then change the angle, but it does not need to be too large, too large will affect the calibration effect. The calibration plate is preferably in the center of the field of view and occupies a large area.
Modify the size of the checkerboard to 27*27mm (my A4 paper measurement is like this).
For standard cameras, select third-order radial distortion and oblique cutting in the option of the menu bar:
for fisheye cameras, select
Click Calibrate to perform camera calibration:
the upper right corner is the reconstruction average error, as long as the average error is less than 0.5, it can be considered that the result of camera calibration is reliable. It's too big here hahaha:
Export the camera parameters and click Export Camera Parameters. Click OK, and you can see the camera parameters appear in the matlab workspace. Click on this parameter, you can get the various parameters of the camera:
- ImageSize: image size
- Radial Distortion: radial distortion
- Tangential Distortion: Tangential Distortion
- World Points: points in the world coordinate system
- World Units: Units in world coordinates
- Estimate Skew: Estimated Skew
- Num Radial Distortion Coefficient: the number of radial distortion coefficients
- Estimate Tangential Distortion: Estimate tangential distortion
- Translation Vectors: translation vector
- Reprojection Errors: reprojection errors
- Detected Keypoints: Detected key points
- Rotation Vectors: rotation vector
- Num Patterns: number of modes
- Intrinsics: internal reference
- Intrinsic Matrix: internal reference matrix
- Focal Length: focal length
- Principal Point: Principal point offset
- Skew: Skew
- Mean Reprojection Error: Average reprojection error
- Reprojected Points: Reprojection points
- Rotation Matrices: The rotation matrix
results are as follows:
2. Make monocular camera yaml file
%YAML:1.0
#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------
Camera.type: "PinHole"
# Camera calibration and distortion parameters (OpenCV)
Camera.fx: 1715.3730
Camera.fy: 1702.5771
Camera.cx: 1129.8076
Camera.cy: 642.5709
Camera.k1: 0.02724
Camera.k2: -0.097636
Camera.k3: 0.10436
Camera.p1: 0.0000127185
Camera.p2: -0.001243
# Camera frames per second
Camera.fps: 30.0
# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 0
# Camera resolution
Camera.width: 640
Camera.height: 480
#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------
# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000
# ORB Extractor: Scale factor between levels in the scale pyramid
ORBextractor.scaleFactor: 1.2
# ORB Extractor: Number of levels in the scale pyramid
ORBextractor.nLevels: 8
# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7
#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 5
Viewer.GraphLineWidth: 0.9
Viewer.PointSize: 2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500
3. Obtain fisheye camera data
Reference link . Photo ditto. The difference here is
that the camera model selects fisheye, and the estimate alignment selects tick, because the official website explains
Estimate the axes alignment, specified as the comma-separated pair consisting of 'EstimateAlignment' and false or true. Set to true if the optical axis of the fisheye lens is not perpendicular to the image plane. Estimate the alignment of the coordinate axes, specified as a
comma A separated pair consisting of 'EstimateAlignment' and false or true. Set to true if the optical axis of the fisheye lens is not perpendicular to the image plane.
Check the Intrinsics Mapping Coefficients in the calculation result cameraParams
: mapping coefficient, [ a 0 a 2 a 3 a 4 ] \left[ \begin{matrix} {
{a}_{0}} & {
{a}_{2}} & {
{a}_{3}} & {
{a}_{4}} \end{matrix} \right][a0a2a3a4], a 1 = 1 {
{a}_{1}}=1 a1=1
Image Size: image size
Distortion Center: distortion center
Stretch Matrix: stretch transformation,[ cde 1 ] \left[ \begin{matrix} c & d \\ e & 1 \\\end{matrix} \right][ced1]