From 9685382eb6eae24b5183fa2761e68ce7816f50be Mon Sep 17 00:00:00 2001 From: Kishor Date: Sun, 21 Aug 2022 11:32:36 +0530 Subject: [PATCH] Set window_size to 1 if round down results in 0. Without this fix, we will get a floating point error in calCoherence method due to divide by zeor --- modules/barcode/src/detector/bardetect.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/barcode/src/detector/bardetect.cpp b/modules/barcode/src/detector/bardetect.cpp index 72990b3cc8a..ec0806970c0 100644 --- a/modules/barcode/src/detector/bardetect.cpp +++ b/modules/barcode/src/detector/bardetect.cpp @@ -86,6 +86,9 @@ void Detect::localization() for (const float scale:SCALE_LIST) { window_size = cvRound(min_side * scale); + if(window_size == 0) { + window_size = 1; + } calCoherence(window_size); barcodeErode(); regionGrowing(window_size);