From bcf5275a01557fbd114d5969c3dccc582a656088 Mon Sep 17 00:00:00 2001 From: Michael Welter Date: Sat, 29 May 2021 17:40:39 +0200 Subject: NeuralnetTracker: Fix crash due to prediction of tiny bounding box --- tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tracker-neuralnet') diff --git a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp index 2fad17aa..7468b2c1 100644 --- a/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp +++ b/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp @@ -379,11 +379,16 @@ bool neuralnet_tracker::detect() iou(*last_localizer_roi,*last_roi)<0.25) { auto [p, rect] = localizer->run(grayscale); - if (p > 0.5) + if (p > 0.5 || rect.height < 5 || rect.width < 5) { last_localizer_roi = rect; last_roi = rect; } + else + { + last_roi.reset(); + last_localizer_roi.reset(); + } } if (!last_roi) -- cgit v1.2.3