getOptimalNewCameraMatrixAsync function

Future<(Mat, Rect)> getOptimalNewCameraMatrixAsync(
  1. InputArray cameraMatrix,
  2. InputArray distCoeffs,
  3. (int, int) imageSize,
  4. double alpha, {
  5. (int, int) newImgSize = (0, 0),
  6. bool centerPrincipalPoint = false,
})

GetOptimalNewCameraMatrixWithParams computes and returns the optimal new camera matrix based on the free scaling parameter.

For further details, please see: https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga7a6c4e032c97f03ba747966e6ad862b1

Implementation

Future<(Mat rval, Rect validPixROI)> getOptimalNewCameraMatrixAsync(
  InputArray cameraMatrix,
  InputArray distCoeffs,
  (int, int) imageSize,
  double alpha, {
  (int, int) newImgSize = (0, 0),
  bool centerPrincipalPoint = false,
}) async {
  final validPixROI = calloc<cvg.CvRect>();
  final rval = Mat.empty();
  return cvRunAsync0<(Mat, Rect)>(
    (callback) => ccalib3d.cv_getOptimalNewCameraMatrix(
      cameraMatrix.ref,
      distCoeffs.ref,
      imageSize.cvd.ref,
      alpha,
      newImgSize.cvd.ref,
      validPixROI,
      centerPrincipalPoint,
      rval.ptr,
      callback,
    ),
    (c) => c.complete((rval, Rect.fromPointer(validPixROI))),
  );
}