Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by zero error in calCoherence() method (opencv_contrib/modules/barcode/src/detector/bardetect.cpp) if the event window_size value is zero #3332

Open
4 tasks done
kishorgandham opened this issue Aug 21, 2022 · 1 comment

Comments

@kishorgandham
Copy link
Contributor

System information (version)
  • OpenCV => 4.6.0
  • Operating System / Platform => Ubuntu 20.04
  • Compiler => g++
Detailed description
Steps to reproduce

Use an image with width 47 pixels and height 160 pixels (any image with width or height less than 100 pixels would work). 47x160 is the image size with which I found the issue.

I followed the steps listed in this doc to run bar code detection and decoding from the following tutorial
https://opencv.org/recognizing-one-dimensional-barcode-using-opencv/

import cv2

bardet = cv2.barcode_BarcodeDetector()
img = cv2.imread("your file path")
ok, decoded_info, decoded_type, corners = bardet.detectAndDecode(img)

The above code results in floating point error (due to divide by zero error when window_size is 0 in calCoherence() method

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
    2308e3cd17da75cafc652cec781db0b4
@kishorgandham
Copy link
Contributor Author

I made a fix to the above issue and created a PR

#3331 #3331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant