From 741aee690176029a715a91a8980bb7d3ed4ffc6f Mon Sep 17 00:00:00 2001 From: Dmitry Kurtaev Date: Fri, 13 Sep 2019 11:50:50 +0300 Subject: [PATCH] Fix dnn object detection sample --- samples/dnn/object_detection.cpp | 2 +- samples/dnn/object_detection.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/dnn/object_detection.cpp b/samples/dnn/object_detection.cpp index 91ccd6c..83ed10d 100644 --- a/samples/dnn/object_detection.cpp +++ b/samples/dnn/object_detection.cpp @@ -347,7 +347,7 @@ void postprocess(Mat& frame, const std::vector& outs, Net& net) int bottom = (int)data[i + 6]; int width = right - left + 1; int height = bottom - top + 1; - if (width * height <= 1) + if (width <= 2 || height <= 2) { left = (int)(data[i + 3] * frame.cols); top = (int)(data[i + 4] * frame.rows); diff --git a/samples/dnn/object_detection.py b/samples/dnn/object_detection.py index 30b677c..8126ee5 100644 --- a/samples/dnn/object_detection.py +++ b/samples/dnn/object_detection.py @@ -126,7 +126,7 @@ def postprocess(frame, outs): bottom = int(detection[6]) width = right - left + 1 height = bottom - top + 1 - if width * height <= 1: + if width <= 2 or height <= 2: left = int(detection[3] * frameWidth) top = int(detection[4] * frameHeight) right = int(detection[5] * frameWidth) -- 2.7.4