Main Content

Lidar Camera Calibrator

Find rotation and translation between lidar and camera

Description

The Lidar Camera Calibrator app interactively performs calibration using images and point clouds captured by a camera and a lidar sensor, respectively to estimate a rigid transformation between them. You can use the transformation matrix to fuse the lidar and camera data or project lidar points onto images.

Using the app, you can:

  • Detect, extract, and visualize checkerboard features from image and point cloud data.

  • Estimate the rigid transformation between the camera and the lidar using feature detection results.

  • Use the calibration results to fuse data from both the sensors. You can visualize point cloud data projected onto the images, and color or grayscale information from the images fused with point cloud data.

  • View the plotted calibration error metrics. You can remove outliers, using a threshold line, and recalibrate the remaining data.

  • Define a region of interest (ROI) around the checkerboard to reduce the computation resources required by the transformation estimation process.

  • Export the transformation and error metric data as workspace variables or MAT files. You can also create a MATLAB® script for the entire workflow.

Lidar Camera Calibrator App Session

Open the Lidar Camera Calibrator App

  • MATLAB Toolstrip: On the Apps tab, under Image Processing and Computer Vision, click the app icon.

  • MATLAB command prompt: Enter lidarCameraCalibrator.

Examples

expand all

Define paths to the image and point cloud files.

imageFilesPath = fullfile(toolboxdir("lidar"),"lidardata", ...
    "calibration","images");
ptCloudFilesPath = fullfile(toolboxdir("lidar"),"lidardata", ...
    "calibration","pointClouds");

Load the checker size and padding values of the checkerboard.

squareSize = 100; % millimeters
padding = [100 100 100 100]; % millimeters

Launch the app with these parameters.

lidarCameraCalibrator(imageFilesPath,ptCloudFilesPath,squareSize,padding)

Related Examples

Parameters

expand all

Load calibration data into app, specified as a file path.

In the Folder for images field, specify the path to the folder that contains the PNG, JPG, JPEG, TIF, or TIFF image files you want to load. Alternatively, select the folder icon next to the field and navigate to the folder containing the images. For example, navigate to this image data, where matlabroot is your MATLAB root folder:

matlabroot\toolbox\lidar\lidardata\calibration\images

In the Folder for point clouds field, specify the path to the folder that contains the sequence of PCD or PLY files you want to load. Alternatively, click the folder icon next to the field and navigate to the folder containing the files, then click Select Folder. For example, navigate to this point cloud data, where matlabroot is your MATLAB root folder:

matlabroot\toolbox\lidar\lidardata\calibration\pointClouds

To view the list of matched pairs, select View Matched Pairs, then select or clear the pairs which you want to import. Ensure that the mapping of the data pairs is accurate, and then click Accept.

Checkerboard detection parameters, specified by units of measurement, size of checkerboard, and padding values.

  • Units — Select the units of measurement from these options: millimeters, centimeters, meters, or inches.

  • Square Size — Specify the size of each checkerboard square as a positive scalar. For example, specify 100 mm as the square size for the data loaded from the calibration folder.

  • Padding — Specify the padding values for the checkerboard as a four-element row vector of nonnegative integers. For example, specify [100 100 100 100] mm padding for the data you loaded from calibration folder in the previous step. For more information on padding, see Checkerboard Guidelines.

Camera intrinsic parameters, specified by selecting Load from Workspace, Load from File, or Compute Intrinsics.

  • Load from Workspace — Load camera intrinsic parameters from a valid variable in the MATLAB workspace. The app supports loading camera intrinsic parameters from the cameraIntrinsics and cameraParameters objects.

  • Load from File — Load camera intrinsic parameters from a valid MAT file that stores data using the cameraIntrinsics or cameraParameters object.

  • Compute Intrinsics — Select this option when you want the app to automatically compute camera intrinsic parameters from the input image data. Note that this app does not support fine-tuning and validation of camera intrinsic parameters and you must use images captured for single camera calibration to obtain these parameters. For best camera calibration results, use the Camera Calibrator app to compute the intrinsics. For information on how to collect data for camera calibration, see Prepare Camera and Capture Images for Camera Calibration.

Tolerance for variation in rectangular board size, specified as a nonnegative scalar in the range [0 1].

Maximum distance to fit a plane to each cluster for board detection in point clouds, specified as a positive scalar. Decrease this value when working with noisy data to obtain more detections by removing outliers.

Programmatic Use

lidarCameraCalibrator opens a new session of the Lidar Camera Calibrator app.

lidarCameraCalibrator(sessionFile) opens the Lidar Camera Calibrator app and loads a previously saved app session, sessionFile.

lidarCameraCalibrator(imageFilesPath,ptCloudFilesPath,squareSize,padding,intrinsics) opens a new session of the app and loads the specified input data. The app reads image files from imageFilesPath and point cloud files from ptCloudFilesPath. Both of these arguments must be valid folders containing images and point clouds, respectively. squareSize is the side length of each square in the checkerboard, specified in millimeters, padding contains the padding values along each side of the board in millimeters, specified as a 4-element row vector, and intrinsics specifies the camera intrinsic parameters as a cameraIntrinsics object.

lidarCameraCalibrator(imageFilesPath,ptCloudFilesPath,squareSize,padding) opens a new session of the app and loads the specified input data. The app will estimate the camera intrinsics from the image data, but this is generally less accurate than specifying them as an input. For higher accuracy, use the Camera Calibrator app with image data collected specifically for intrinsic calibration, then provide the resulting intrinsics as an input in the previous syntax.

Version History

Introduced in R2021a

expand all