Matlab标定

Matlab R2015双目标定

Stereo Camera Calibrator Overview

You can use the Stereo Camera Calibrator app to calibrate a stereo camera, which you can then use to recover depth from images. A stereo system consists of two cameras: camera 1 and camera 2. The app estimates the parameters of each of the two cameras. It also calculates the position and orientation of camera 2 relative to camera 1.

The app produces an object containing the stereo camera parameters. You can use this object to rectify stereo images using the rectifyStereoImagesfunction, reconstruct the 3-D scene using the reconstructScene function, or compute 3-D locations corresponding to matching pairs of image points using the triangulate function.

The suite of calibration functions used by the Stereo Camera Calibrator app provide the workflow for stereo system calibration. You can use them directly in the MATLAB® workspace. For a list of functions, see Single Camera Calibration.

  • Note:   You can use the Camera Calibrator app with cameras up to a field of view (FOV) of 95 degrees.

Stereo Camera Calibration

Follow this workflow to calibrate your stereo camera using the app:

  1. Prepare images, camera, and calibration pattern.

  2. Load image pairs.

  3. Calibrate the stereo camera.

  4. Evaluate calibration accuracy.

  5. Adjust parameters to improve accuracy (if necessary).

  6. Export the parameters object.

In some cases, the default values work well, and you do not need to make any improvements before exporting parameters. If you do need to make improvements, you can use the camera calibration functions in MATLAB. For a list of functions, see Single Camera Calibration.

Open the Stereo Camera Calibrator

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

  • MATLAB command prompt: Enter stereoCameraCalibrator

Image, Camera, and Pattern Preparation

For best results, use between 10 and 20 images of the calibration pattern. The calibrator requires at least three images. Use uncompressed images or lossless compression formats such as PNG. The calibration pattern and the camera setup must satisfy a set of requirements to work with the calibrator. For greater calibration accuracy, follow these instructions for preparing the pattern, setting up the camera, and capturing the images.

 Prepare the Checkerboard Pattern

 Camera Setup

 Capture Images

Add Image Pairs

To begin calibration, click Add images to add two sets of stereo images of the checkerboard. You can add images from multiple folders by clicking Add images. Select the locations for the images corresponding to camera 1 and camera 2. Enter the length of one side of a square from the checkerboard pattern.

Analyze Images

The calibrator attempts to detect a checkerboard in each of the added images. An Analyzing Images progress bar window appears, indicating detection progress.

If any of the image pairs are rejected, the Detection Results window appears, which contains diagnostic information. The results indicate how many total image pairs were processed, and how many were accepted, rejected, or skipped The calibrator skips duplicate images.

To view the rejected images, click view images. The calibrator rejects duplicate images. It also rejects images where the entire checkerboard could not be detected. Possible reasons for no detection are a blurry image or an extreme angle of the pattern. Detection takes longer with larger images and with patterns that contain a large number of squares.

View Images and Detected Points

The Data Browser pane displays a list of image pairs with IDs. These image pairs contain a detected pattern. To view an image, select it from the Data Browser pane.

The Image pane displays the checkerboard image pair with green circles to indicate detected points. You can verify the corners were detected correctly using the zoom controls. The yellow square indicates the (0,0) origin. The X and Y arrows indicate the checkerboard axes orientation.

Calibrate

Once you are satisfied with the accepted image pairs, click Calibrate. The default calibration settings assume the minimum set of camera parameters. Start by running the calibration with the default settings. After evaluating the results, you can try to improve calibration accuracy by adjusting the settings and adding or removing images, and then calibrate again.

 Set Initial Guesses for Camera Intrinisics and Radial Distortion

Evaluate Calibration Results

You can evaluate calibration accuracy by examining the reprojection errors and the camera extrinsics, and by viewing the undistorted image. For best calibration results, use all three methods of evaluation.

 Examine Reprojection Errors

 Examine Extrinsic Parameter Visualization

 Show Rectified Images

Improve Calibration

To improve the calibration, you can remove high-error image pairs, add more image pairs, or modify the calibrator settings.

 Add and Remove Image Pairs

 Change the Number of Radial Distortion Coefficients

 Compute Skew

 Compute Tangential Distortion

Export Camera Parameters

When you are satisfied with calibration accuracy, click Export Camera Parameters. You can save and export the camera parameters to an object or generate the camera parameters as a MATLAB script.

Export Camera Parameters

Click Export Camera Parameters to create a stereoParameters object in your workspace. The object contains the intrinsic and extrinsic parameters of the camera, and the distortion coefficients. You can use this object for various computer vision tasks, such as image undistortion, measuring planar objects, and 3-D reconstruction. You can optionally export the stereoCalibrationErrors object, which contains the standard errors of estimated stereo parameters.

Generate MATLAB Script

You can also generate a MATLAB script which allows you save and reproduce the steps from your calibration session.

References

[1] Zhang, Z. "A Flexible New Technique for Camera Calibration". IEEE Transactions on Pattern Analysis and Machine Intelligence.Vol. 22, No. 11, 2000, pp. 1330–1334.

[2] Heikkila, J, and O. Silven. "A Four-step Camera Calibration Procedure with Implicit Image Correction." IEEE International Conference on Computer Vision and Pattern Recognition. 1997.

See Also

Camera Calibrator | cameraParameters | detectCheckerboardPoints | estimateCameraParameters | generateCheckerboardPoints | showExtrinsics | showReprojectionErrors | Stereo Camera Calibrator | stereoParameters | undistortImage

Related Examples

More About

External Websites




Matlab相机标定是一种将世界坐标系中的点转换为图像坐标系中的点的过程。首先需要获取相机的参数,包括相机内参、平移矩阵和旋转矩阵。相机内参是固定的,而平移矩阵和旋转矩阵是针对每幅图像分别计算得到的。 在标定过程中,可以使用标定板来获取图像和参数。标定板的格子大小可以根据实际情况进行设置,例如0.3mm×0.3mm。通过标定板的图像和已知的世界坐标系中的点,可以计算出相机的内参、平移矩阵和旋转矩阵。 一旦获取了相机的参数,就可以进行坐标转换。假设标定板的横边和纵边之间的角度为90°。在转换过程中,可以选择世界坐标系中的两个点,例如(0,0)和(0,0.3mm),并通过参数计算出对应的图像坐标系中的位置。 需要注意的是,在计算图像坐标系中的位置时,需要考虑尺度因子s。所以,需要将得到的图像坐标除以s,并将结果的第三个元素设置为1,以得到实际的图像坐标。同时,Matlab中获取到的角点检测对应点坐标也需要进行相应的处理。 综上所述,Matlab相机标定包括获取相机参数和进行坐标转换两个主要步骤。通过这些步骤,可以将世界坐标系中的点转换为图像坐标系中的点,实现坐标转换的功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Matlab相机标定方法及主要参数含义,坐标变换过程](https://blog.csdn.net/qq_41372644/article/details/121089361)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值