CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
1D Barcode support #2757
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
1D Barcode support #2757
Conversation
562484d
to
3a9120a
Compare
e157215
to
2167cc9
Compare
Signed-off-by: Killer_Quinn <51754303+Certseeds@users.noreply.github.com>
Signed-off-by: Killer_Quinn <51754303+Certseeds@users.noreply.github.com>
The building bot |
β¦oint2f>>, barcodeDirectly now just output one string, this commit is still only contain interface, barcode module will not be compile. Signed-off-by: Killer_Quinn <51754303+Certseeds@users.noreply.github.com>
Now, we pushed the implementation code that was tested in Raspberry Pi 4B and win64. |
f0e55d2
to
b8f0115
Compare
@alalek Hi, I thought our interface code was written in correct format, but there is no our class(BarcodeDetector) in the generated Python bindings. The Python interpreter shows: PS C:\WINDOWS\System32> python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2.barcode as barcode
>>> barcode.BarcodeDetector()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'cv2.barcode' has no attribute 'BarcodeDetector'
>>> dir(barcode)
['EAN_13', 'EAN_8', 'NONE', 'UPC_A', 'UPC_E', 'UPC_EAN_EXTENSION', '__doc__', '__loader__', '__name__', '__package__', '__spec__'] Can you help us for this? |
thank you for the contribution! Could you please implement some regression tests and add example in C++ or Python that uses this functionality? |
c952114
to
69faf4d
Compare
@alalek Hi, we added the tests and sample, but tests failed because test data was not merged into opencv_extra. Can you fix it? |
69faf4d
to
4ae4d1b
Compare
opencv_extra PR must be created from the same "user" GitHub account and use the same source branch name as "main" PR (to run validation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
modules/barcode/tutorials/barcode_detect_and_decode/barcode_detect_and_decode.markdown
Outdated
Show resolved
Hide resolved
6894335
to
aa3b707
Compare
aa3b707
to
30aedeb
Compare
30aedeb
to
94d38d5
Compare
Thanks for review, we have updated the code again. By the way, we figured out the usage of generated python code, it should be |
6c5cd95
to
1b1c54d
Compare
e1c7132
to
43e6e6f
Compare
π |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution!
Please take a look on the comments below.
// Author: darkliang | ||
|
||
#ifndef BARCODE_CONVERTERS_HPP | ||
#define BARCODE_CONVERTERS_HPP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove tabs from source code files
//void UPCEANDecoder::drawDebugLine(Mat &debug_img, const Point2i &begin, const Point2i &end) const | ||
//{ | ||
// Result result; | ||
// std::vector<uchar> middle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//
Instead of using of multi-line comments, consider using of #if 0
to disable debug parts in the code.
// calculate magnitude of gradient, normalize and threshold | ||
magnitude(scharr_x, scharr_y, gradient_magnitude); | ||
threshold(gradient_magnitude, gradient_magnitude, 56, 1, THRESH_BINARY); | ||
gradient_magnitude.convertTo(gradient_magnitude, CV_8U); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to avoid in-placing of in/out parameters.
Especially with different types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to avoid in-placing of in/out parameters.
Especially with different types.
I did not really understand what's your point? I rewrote the code like this:
magnitude(scharr_x, scharr_y, temp);
threshold(temp, temp, THRESHOLD_MAGNITUDE, 1, THRESH_BINARY);
temp.convertTo(gradient_magnitude, CV_8U);
pt = Point(x, y); | ||
cur_value = orientation.at<float_t>(pt); | ||
sin_sum = sin(2 * cur_value); | ||
cos_sum = cos(2 * cur_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, in general sin
/cos
computation in nested loops is not very cheap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for checking this.
You are right, this is not critical part of computations for now.
Possible optimization are usually done through using of pre-computed sin/cos tables (with input value quantization).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! Thank you π
@alalek Thanks for your review. I fixed up a bug about java binding, please check. π |
Merge with extra: opencv/opencv_extra#860
opencv/opencv#18668