cv.getOptimalNewCameraMatrix - MATLAB File Help |
Returns the new camera matrix based on the free scaling parameter
cameraMatrix = cv.getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize)
[cameraMatrix, validPixROI] = cv.getOptimalNewCameraMatrix(...)
[...] = cv.getOptimalNewCameraMatrix(..., 'OptionName', optionValue, ...)
A = [fx 0 cx; 0 fy cy; 0 0 1]
.[k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,taux,tauy]
of 4, 5, 8, 12 or 14
elements. If the vector is empty, the zero distortion coefficients are
assumed.[w,h]
.[x,y,w,h]
that outlines
all-good-pixels region in the undistorted image. See roi1
, roi2
description in cv.stereoRectify.[w,h]
. By default, it is
set to imageSize
.Alpha
) to the corrected image. default false.The function computes and returns the optimal new camera matrix based on the
free scaling parameter. By varying this parameter, you may retrieve only
sensible pixels Alpha=0
, keep all the original image pixels if there is
valuable information in the corners Alpha=1
, or get something in between.
When Alpha>0
, the undistorted result is likely to have some black pixels
corresponding to "virtual" pixels outside of the captured distorted image.
The original camera matrix, distortion coefficients, the computed new camera
matrix, and newImageSize
should be passed to cv.initUndistortRectifyMap to
produce the maps for cv.remap.