-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
Python wrapper - Multiple decode barcodes #131
Comments
This is related to #105. And as in that case, the best approach depends on your application. Allow me to ask 3 questions:
|
Hi axxel, Thank you very much for your quick answer. Regarding the questions you asked me:
I want to clarify that as I put on the topic I am using right now the Python wrapper so, after install it I use:
Additionally, I want to say that I saw the #105 issue but the idea is a bit different, because as I understood they want to read a grid of barcodes in "always" the same position more or less. As I said in my case the barcodes can be in any part of the image and the background is not white. Thank you very much. Cheers, Víctor |
Now I have more questions: :)
Note: the example python you showed, uses the original interface. That has been deprecated recently and made more consistent with the rest of the pubic API. If possible, please use the latest code directly from github. |
ad 1: If your codes are far enough apart from one another (like in your example) then the approach implemented in GenericMultipleBarcodeReader.java should work well. Maybe you can try to port that code over to c++ and we can see how to integrate it? Alternatively, you should be able to implement that in python on top of the currently available API. ad 2: The thing is, if the codes start to come close to each other and then possibly also be rotated arbitrarily, then the above approach will fail. And making that work then will need more knowledge about the type of codes you can simultaneously encounter and be more work to implement. |
This can be considered a fix for #131 as it provides a solution and works for both presented examples.
Here is a import sys, zxingcpp
from PIL import Image
img = Image.open(sys.argv[1])
results = zxingcpp.read_barcodes(img, zxingcpp.BarcodeFormat.OneDCodes)
if len(results) > 0:
for result in results:
print("Found barcode:\n Text: '{}'\n Format: {}\n Position: {}"
.format(result.text, result.format, result.position))
else:
print("Could not find any barcode") Feedback would be welcome (also from @antoinehumbert @TransparentLC @urishab?). Note that the 'backend' currently does not support multiple 2D symbols of the same format, yet. |
Hi axxel, Thank you very much to inform us and show us this example. Cheers, Víctor |
Hi again axxel, I am trying to run the code that you provided here but the library does not have this read_barcodes function. I installed the last version of master. The error that appears is: I have version 1.2.0 installed and I made the python setup.py install inside the repository. Could you please give me some feedback related to this? Thank you again. Cheers, Víctor |
@as3nsi0 The 1.2.0 release does not have this function, yet. You need to checkout HEAD (the latest). |
Yes, axxel you were right, I think that the problem was that I had not uninstalled the package. I uninstalled the package, pull master (just in case), and installed it again. Now it works without any problem. I guess that the thread can be closed. Thank you again axxel. Cheers, |
In the new python wrapper release zxing-cpp 1.4.0, still we could not detect multiple datamatrix codes and also unable to detect single datamatrix codes also |
Any workarounds to make it happen for datamatrix detection like QR detection which works perfectly fine |
You have to build the wrapper yourself with c++20 support enabled. Replace the "17" with "20" in the line |
Atleast I have noticed multiple times, it fails to detect even single datamatrix images. Why does it happen? |
Without the c++20 support it currently only detects symbols that intersect with the horizontal center-line (or if |
I saw that comment. Is there any way to set tryHarder = True as an argument in the python wrapper release zxing-cpp 1.4.0 or any other versions |
No there is not. You have to build the wrapper yourself. |
okay. Thank you so much for the quick reply |
Hi everybody,
I was testing your Python wrapper and it works very well, for this reason, I would like to ask if is there any plan to add in the future the possibility to read multiple barcodes from the same image?
For example here, in this picture, I would like to obtain both readings but I only received one.
If I test the same in the original ZXing it works well and returns the two barcodes.
Thanks in advance for your help.
Cheers,
Víctor
The text was updated successfully, but these errors were encountered: