getOptimalNewCameraMatrix
import { getOptimalNewCameraMatrix } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Returns the new camera intrinsic matrix based on the free scaling parameter.
getOptimalNewCameraMatrix(cameraMatrix: Mat, distCoeffs: Mat, imageSize: Size, alpha: number, newImgSize: Size, centerPrincipalPoint: boolean): getOptimalNewCameraMatrixResult;3 available overloads
getOptimalNewCameraMatrix(cameraMatrix: Mat, distCoeffs: Mat, imageSize: Size, alpha: number): getOptimalNewCameraMatrixResult;getOptimalNewCameraMatrix(cameraMatrix: Mat, distCoeffs: Mat, imageSize: Size, alpha: number, newImgSize: Size): getOptimalNewCameraMatrixResult;getOptimalNewCameraMatrix(cameraMatrix: Mat, distCoeffs: Mat, imageSize: Size, alpha: number, newImgSize: Size, centerPrincipalPoint: boolean): getOptimalNewCameraMatrixResult;cameraMatrixInput camera intrinsic matrix.
distCoeffsInput vector of distortion coefficients
\distcoeffs. If the vector is NULL/empty, the zero distortion coefficients are assumed.imageSizeOriginal image size.
alphaFree scaling parameter between 0 (when all the pixels in the undistorted image are valid) and 1 (when all the source image pixels are retained in the undistorted image). See #stereoRectify for details.
newImgSizeImage size after rectification. By default, it is set to imageSize .
centerPrincipalPointOptional flag that indicates whether in the new camera intrinsic matrix the principal point should be at the image center or not. By default, the principal point is chosen to best fit a subset of the source image (determined by alpha) to the corrected image.
new_camera_matrix Output new camera intrinsic matrix.
The function computes and returns the optimal new camera intrinsic 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 intrinsic matrix, distortion coefficients, the computed new camera intrinsic matrix, and newImageSize should be passed to #initUndistortRectifyMap to produce the maps for #remap . Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.