From 130a5317a107f7d5cf2f19276ad68adda4978132 Mon Sep 17 00:00:00 2001 From: GoLez28 <15484340+GoLez28@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:47:06 -0300 Subject: [PATCH] fixed wrong detection when calibrating, patch to fix crash when closing frame windows --- TrackingSmoothing/Aruco.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TrackingSmoothing/Aruco.cs b/TrackingSmoothing/Aruco.cs index 49d064a..71e1c98 100644 --- a/TrackingSmoothing/Aruco.cs +++ b/TrackingSmoothing/Aruco.cs @@ -260,7 +260,8 @@ public static void Update(int c) { System.Diagnostics.Stopwatch arucoThreadIdleBenchmark = new System.Diagnostics.Stopwatch(); arucoThreadWorkBenchmark.Start(); if (Program.wantToCloseWindows) { - CvInvoke.DestroyAllWindows(); + CvInvoke.DestroyWindow($"Image{c}"); + System.Threading.Thread.Sleep(1000); Program.wantToCloseWindows = false; } bool shouldShowFrame = Program.wantToShowFrame; @@ -359,7 +360,7 @@ public static void Update(int c) { VectorOfVectorOfPointF rejected = new VectorOfVectorOfPointF(); // rejected contours bool halfFrame = useDynamicFraming && frameCount % 6 != 0; - halfFrame |= TrackerCalibrate.startCalibrating || CameraCalibrate.startCalibrating || RoomCalibrate.getRawTrackersStep > -1; + halfFrame &= !(TrackerCalibrate.startCalibrating || CameraCalibrate.startCalibrating || RoomCalibrate.getRawTrackersStep > -1); halfFrame &= !Tag.cameras[c].inWaitMode; if (!halfFrame) { ArucoInvoke.DetectMarkers(frame, ArucoDict, corners, ids, ArucoParameters, rejected);