initUndistortRectifyMap function

(Mat, Mat) initUndistortRectifyMap(
  1. InputArray cameraMatrix,
  2. InputArray distCoeffs,
  3. InputArray R,
  4. InputArray newCameraMatrix,
  5. (int, int) size,
  6. int m1type, {
  7. OutputArray? map1,
  8. OutputArray? map2,
})

InitUndistortRectifyMap computes the joint undistortion and rectification transformation and represents the result in the form of maps for remap

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

Implementation

(Mat map1, Mat map2) initUndistortRectifyMap(
  InputArray cameraMatrix,
  InputArray distCoeffs,
  InputArray R,
  InputArray newCameraMatrix,
  (int, int) size,
  int m1type, {
  OutputArray? map1,
  OutputArray? map2,
}) {
  final p1 = map1?.ptr ?? calloc<ccalib3d.Mat>();
  final p2 = map2?.ptr ?? calloc<ccalib3d.Mat>();
  cvRun(
    () => ccalib3d.InitUndistortRectifyMap(
      cameraMatrix.ref,
      distCoeffs.ref,
      R.ref,
      newCameraMatrix.ref,
      size.cvd.ref,
      m1type,
      p1,
      p2,
    ),
  );
  return (map1 ?? Mat.fromPointer(p1), map2 ?? Mat.fromPointer(p2));
}