QR Reader/Decoder Lib?
QR Reader/Decoder Lib?
I just started out with MP a week or so ago.
Are there any QR code decoder libraries like zbar or quirc that I can upip install?
I haven't found anything in my searching so far.
If not, is there a good guide on how to take an existing Python/C module and adapt it for MP?
Thanks!
Are there any QR code decoder libraries like zbar or quirc that I can upip install?
I haven't found anything in my searching so far.
If not, is there a good guide on how to take an existing Python/C module and adapt it for MP?
Thanks!
Re: QR Reader/Decoder Lib?
I can imagine that QR decoding could be very slow in Python, so writing it in C probably makes sense (especially if you have an existing library).
Interestingly, the reverse (creation of QR codes) was one of the very first examples of the new "dynamic native modules" feature. Matt gave a talk about it here: https://www.youtube.com/watch?v=437CZBnK8vI I think the code is here: https://github.com/mattytrentini/microp ... modules/qr
Docs for the feature are here: http://docs.micropython.org/en/latest/d ... atmod.html
Interestingly, the reverse (creation of QR codes) was one of the very first examples of the new "dynamic native modules" feature. Matt gave a talk about it here: https://www.youtube.com/watch?v=437CZBnK8vI I think the code is here: https://github.com/mattytrentini/microp ... modules/qr
Docs for the feature are here: http://docs.micropython.org/en/latest/d ... atmod.html
I'm not sure if by Python/C you mean a "CPython module implemented in C" (not really, the API is totally different), or just "any Python or C module" (the former should be fairly straightfowards, the latter see above).
Re: QR Reader/Decoder Lib?
Thanks for the response.
When I wrote "PythonC/C", I meant something like this: https://pypi.org/project/quirc/ or this: https://pypi.org/project/zbar-py/
Which as you suggest are a C libraries with a Python wrapper.
I actually watched that video you linked the other day, but it's not clear to me if I can take something like the above Python-wrapped C code and just put it into the right spot in the MP hierarchy and have it compile or whether I need to write a completely different wrapper.
And if the latter, where does each of the files need to go so that they are compiled properly and available to import from other code.
Thanks.
When I wrote "PythonC/C", I meant something like this: https://pypi.org/project/quirc/ or this: https://pypi.org/project/zbar-py/
Which as you suggest are a C libraries with a Python wrapper.
I actually watched that video you linked the other day, but it's not clear to me if I can take something like the above Python-wrapped C code and just put it into the right spot in the MP hierarchy and have it compile or whether I need to write a completely different wrapper.
And if the latter, where does each of the files need to go so that they are compiled properly and available to import from other code.
Thanks.
Re: QR Reader/Decoder Lib?
Nope, the CPython API bindings are totally different to MicroPython.MindJuice wrote: ↑Tue Apr 14, 2020 7:19 amI actually watched that video you linked the other day, but it's not clear to me if I can take something like the above Python-wrapped C code and just put it into the right spot in the MP hierarchy and have it compile or whether I need to write a completely different wrapper.
You'll need to write the MicroPython bindings.
Start with the example in http://docs.micropython.org/en/latest/d ... atmod.html and see if you can compile very basic .mpy file.
You just need to clone the main micropython repo and set MPY_DIR to the path where you cloned it in that Makefile.
The other option of course is that you can just build it directly into the main firmware. i.e. start with https://github.com/micropython/micropython and compile it for whichever board you're using, then look at the instructions here http://docs.micropython.org/en/latest/d ... dules.html for how to write a custom module that's compiled into the firmware.
Re: QR Reader/Decoder Lib?
Thanks. I'll take a look at those links tonight.
Re: QR Reader/Decoder Lib?
OpenMV has a copy of quirc in it:
https://github.com/openmv/openmv/blob/m ... g/qrcode.c
and has some micropython interfaces as well:
https://github.com/openmv/openmv/blob/m ... 5324-L5492
https://github.com/openmv/openmv/blob/m ... g/qrcode.c
and has some micropython interfaces as well:
https://github.com/openmv/openmv/blob/m ... 5324-L5492
Re: QR Reader/Decoder Lib?
Thanks! This definitely looks worth a go.
I just have to figure out how to extract the relevant bits into my project.
I just have to figure out how to extract the relevant bits into my project.
Re: QR Reader/Decoder Lib?
I ended up using in the quirc C code directly from their github repo and writing a fairly simple MP wrapper for it. Their example code is a really great starting point. https://github.com/dlbeer/quirc
I was able to test it with a sample image file today and it recognized the QR code!
This code will all be open source once it's done (~2-3 months), but for now, it's in a private repo.
If anyone wants it sooner, I can take some time to sanitize it for public consumption.
Cheers!
I was able to test it with a sample image file today and it recognized the QR code!
This code will all be open source once it's done (~2-3 months), but for now, it's in a private repo.
If anyone wants it sooner, I can take some time to sanitize it for public consumption.
Cheers!
Re: QR Reader/Decoder Lib?
Hi,
Were you to complete the project for verification of QR code using esp32-cam on micropython? if yes, i would be very much interested in testing out for one of my requirements.
Thanks
Were you to complete the project for verification of QR code using esp32-cam on micropython? if yes, i would be very much interested in testing out for one of my requirements.
Thanks
Re: QR Reader/Decoder Lib?
Hello,MindJuice wrote: ↑Mon Apr 20, 2020 7:20 amI ended up using in the quirc C code directly from their github repo and writing a fairly simple MP wrapper for it. Their example code is a really great starting point. https://github.com/dlbeer/quirc
I was able to test it with a sample image file today and it recognized the QR code!
This code will all be open source once it's done (~2-3 months), but for now, it's in a private repo.
If anyone wants it sooner, I can take some time to sanitize it for public consumption.
Cheers!
Is your code available ? Thank you