summaryrefslogtreecommitdiffhomepage
path: root/tracker-neuralnet/ftnoir_tracker_neuralnet.cpp
diff options
context:
space:
mode:
authorMichael Welter <michael@welter-4d.de>2021-05-29 17:40:39 +0200
committerMichael Welter <michael@welter-4d.de>2021-05-29 18:13:10 +0200
commitbcf5275a01557fbd114d5969c3dccc582a656088 (patch)
treeb692afa6c68d69bfd2a56a030ad8c93e49133a02 /tracker-neuralnet/ftnoir_tracker_neuralnet.cpp
parent11c7d06743a419dbcca082dc7e28640d023e3503 (diff)
NeuralnetTracker: Fix crash due to prediction of tiny bounding box
Diffstat (limited to 'tracker-neuralnet/ftnoir_tracker_neuralnet.cpp')
-rw-r--r--tracker-neuralnet/ftnoir_tracker_neuralnet.cpp7
1 files changed, 6 insertions, 1 deletions
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)