From 08572a664aeae1f136a6b8ff1e64c10be8857ded Mon Sep 17 00:00:00 2001 From: Rodney Richardson Date: Wed, 22 Dec 2021 15:16:28 +0000 Subject: [PATCH] Fix GC.KeepAlive() calls in EstimateAffine2D and EstimateAffinePartial2D. --- src/OpenCvSharp/Cv2/Cv2_calib3d.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs index 9fe60f441..38182ed42 100644 --- a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs +++ b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs @@ -3615,8 +3615,8 @@ public static double SampsonDistance(Point3d pt1, Point3d pt2, double[,] f) from.CvPtr, to.CvPtr, ToPtr(inliers), (int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr)); - GC.KeepAlive(inliers); - GC.KeepAlive(inliers); + GC.KeepAlive(from); + GC.KeepAlive(to); GC.KeepAlive(inliers); return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr); @@ -3655,8 +3655,8 @@ public static double SampsonDistance(Point3d pt1, Point3d pt2, double[,] f) from.CvPtr, to.CvPtr, ToPtr(inliers), (int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr)); - GC.KeepAlive(inliers); - GC.KeepAlive(inliers); + GC.KeepAlive(from); + GC.KeepAlive(to); GC.KeepAlive(inliers); return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr);