Get Undistorted Camera Matrix

9 ビュー (過去 30 日間)
Alec
Alec 2023 年 8 月 16 日
回答済み: Giridharan Kumaravelu 2023 年 8 月 18 日
I have calibrated a Camera using the Camera Calibrator App which producted a CameraParameters data structure. I can use that datastruct and the :
undistortImage()
Fucnction to generate a new undistorted image. I would like to get the new Camera Matrix from this undistortion method similar to opencv getOptimalNewCameraMatrix method but dont see a way to do this short of doing the math myself. How can I get the new camera matrix for the undistorted image?

回答 (1 件)

Giridharan Kumaravelu
Giridharan Kumaravelu 2023 年 8 月 18 日
The answer to this question depends on undistortImage function's Name-Value argument OutputView. If it is not used and left to use its default value of OutputView="same", then the new camera matrix will be the same as the original camera matrix in the exported cameraParameters.
If the OutputView is set to "full" or "valid", then the principal point of the original camera matrix must be translated to form the new camera matrix. In short, you could do the following to account for all these 3 cases:
% Undistort the image specifying the desired OutputView.
[J, newOrigin] = undistortImage(I, cameraParams, OutputView=view)
% Translate the principal point. newOrigin is zero if OutputView="same"
newPrincipalPoint = cameraParams.PrincipalPoint - newOrigin;
newImageSize = size(J,1:2);
% Create a new cameraIntrinsics object which contains the new camera matrix.
newIntrinsics = cameraIntrinsics(cameraParams.FocalLength, newPrincipalPoint, ...
newImageSize, Skew=cameraParams.Skew);

カテゴリ

Help Center および File ExchangeMATLAB Support Package for USB Webcams についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by