Metashape can be used for automatic lens calibration that helps to ensure those lens distortions are well simulated by the camera model used in the software. The calibration target acceptable in Metashape is a chessboard pattern on LCD screen, alternatively, a printed chessboard pattern can be used providing that it is flat and all its cells are squares. Lens calibration procedure supports estimation of the full camera calibration matrix, including non-linear distortion coefficients.
We recommend following this approach for close-range capturing scenarios. It is preferable that the images of the calibration board are taken with the same distance from the camera as the planned distance to the object for 3D reconstruction.
For aerial photography, we recommend that you calibrate the camera on the reference site using ground control points. In case you're using the approach described in this article make sure that your lens is focused on infinity.
This article provides instructions on how to:
- Capture photos of the calibration pattern
- Load Photos
- Calibrate the camera lens
- Using camera calibration parameters
The lens calibration tool can be used only once a set of photos of the calibration pattern is loaded in Metashape.
Capture photos of the calibration pattern
To capture photos of the calibration pattern:
1. In Metashape menu Tools > submenu Lens select Show Chessboard... command to display the calibration pattern.
2. Scale the calibration pattern so that the number of squares on each side of the screen would exceed 10. Use mouse scroll wheel to zoom in/out the calibration pattern.
3. Use your camera to capture a series of photos of the displayed calibration pattern from slightly different angles (follow the guidelines outlined below). The minimum number of photos for a given focal length is 3.
4. If you are calibrating a zoom lens repeat step 3 for various focal length settings.
Consider following the guidelines below when capturing photos of the calibration pattern:
- Make sure that the focal length is constant throughout the session (in the case of a zoom lens).
- Avoid glare on the photos. Move the light sources away if required.
- The calibration pattern should take a maximum area of each photo. Move the camera closer to the LCD screen if required.
5. Right-click on the calibration pattern or press Escape button to return to the program.
6. Upload the captured photos to the computer.
To load photos of the calibration pattern:
1. Create a new chunk using Add Chunk toolbar button on the Workspace pane or selecting Add Chunk command from the Workspace context menu (available by right-clicking on the root element on the Workspace pane).
2. Select Add Photos... command from the Workflow menu.
3. Browse to the folder containing the photos of the calibration pattern and select files to be used. Then click Open button.
4. Loaded photos will appear in the Photos pane.
Calibrate the camera lens
To calibrate the camera lens
1. Open Camera Calibration... dialog available from the Tools menu and make sure that Camera Type setting corresponds the lens to be calibrated. Use Fisheye value for fisheye lens and Frame camera for prime lens or zoom lens.
2. Select Calibrate Lens... command from the Lens submenu in the Tools menu.
3. In the Calibrate Lens dialog box, select the desired calibration parameters. Click OK button when done.
4. The progress dialog box will appear displaying the current processing status. To cancel processing click the Cancel button.
5. The calibration results will appear on the Adjusted tab of the Camera Calibration... dialog available from the Tools menu.
Once the calibration procedure is completed it will be possible for you to observe the detected chessboard corners on each photo (the photo can be opened by double-clicking on its name in the Photos pane). The majority of the corners should be detected correctly, if not - we recommend to collect a new set of calibration images and re-run the procedure.
For each detected corner the reprojection error is displayed: it characterizes the difference between the detected corner position and its' position estimated according to the calculated calibration. The errors are scaled x20 times for display.
The detected corners are marked with red, blue, and gray points. Red and blue points are used for calibration, while gray points are not. It is important that each color point has points of a different color as its nearest neighbors.
Use Save button on the Adjusted tab to save the adjusted values for camera calibration parameters to file. The saved lens calibration data can later be used in another chunk or project for the actual dataset captured with the same camera and lens.
Using camera calibration parameters
After you have saved the calibration parameters for the lens, you may proceed with the workflow steps in a separate chunk (or in a separate project) for an actual dataset captured with the same camera and lens.
1. Create a new chunk in the current project (where the camera calibration procedure had been performed) or open/create a project.
2. Open the dataset using Add Photos command on the Workflow menu for the new chunk.
3. Load calculated camera calibration parameters. For the purpose open Camera Calibration dialog from the Tools menu and use Load button on the Initial tab.
4. To protect the calibration data from being refined during Align Photos process on the Initial tab use Select... button for the option Fixed parameters: in the Fixed parameters dialog window choose Check all box (alternatively you may select only those parameters that you want to be preserved during alignment procedure). Thus initial calibration values will not be changed during the alignment processing step.
5. Press OK button to confirm and proceed with the general workflow starting with the Align Photos step. You may find the information about workflow in Metashape in this solution