-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Labels
Description
System information (version)
4.x - Current Master Branch
Detailed description
In barcode module, detectAndDecode method calls:-
checkBarInputImage- which checks if image is graychannel and if not it converts it to gray channel.(among few others check).detect- Next, it callsdetectmethod with original input image, and not the graychannel image. Later on, the methoddetectuses the samecheckBarInputImageto reconvert the original input image to graychannel.
Relevant Lines of detectAndDecode:-
opencv_contrib/modules/barcode/src/barcode.cpp
Lines 252 to 258 in e94ec40
| if (!checkBarInputImage(img, inarr)) | |
| { | |
| points_.release(); | |
| return false; | |
| } | |
| vector<Point2f> points; | |
| bool ok = this->detect(img, points); |
Relevant Lines of detect:-
opencv_contrib/modules/barcode/src/barcode.cpp
Lines 178 to 186 in e94ec40
| Mat inarr; | |
| if (!checkBarInputImage(img, inarr)) | |
| { | |
| points.release(); | |
| return false; | |
| } | |
| Detect bardet; | |
| bardet.init(inarr); |
Steps to reproduce
Not a logic bug, just a little unnecessary computation overhead.
I will add PR once I have green light from one of contributors.
The line
| bool ok = this->detect(img, points); |
needs to be changed from img to inarr.
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc