diff --git a/samples/dnn/object_detection.cpp b/samples/dnn/object_detection.cpp index 91ccd6c31e..83ed10db5d 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 30b677c2c8..8126ee58aa 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)