diff options
-rw-r--r-- | tracker-neuralnet/ftnoir_tracker_neuralnet.cpp | 7 |
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) |