0

I'm working on an Android app. It's a QRCodeScanner, with Kivy and python. The code works fine on windows, but when I compile to Android, it doesn't recognize QRCodes, but it recognize only Barcodes. Here is my code

label = Label(text="", halign='left', valign='bottom', size_hint=(.5,.2))
x = Camera(play=True, index=0)
class MyCamera(App):
    def build(self):
        self.window = GridLayout()
        self.window.cols = 1
        Window.size = (360, 640)
        self.window.add_widget(x)
        self.window.add_widget(label)
        Clock.schedule_interval(self.update, 1.0 / 33.0)
        return self.window
    def update(self, dt):
        texture = x.texture
        size = texture.size
        pixels = texture.pixels
        pil_image = Image.frombytes(mode="RGBA", size=size, data=pixels)
        numpypicture = numpy.array(pil_image)
        decoded = pyzbar.pyzbar.decode(numpypicture)
        label.text = str(decoded)
        if len(str(decoded)) > 2:
            # do something

I also tried to use cv2, but it crashes at startup for something like "not compatible with android"

Buildozer.spec file

requirements =python3,kivy,pyzbar,Pillow,numpy

fullscreen = 1

android.permissions = INTERNET,CAMERA

this is all what I changed

Also, the camera is rotated by 90° on Android, but on windows works fine

Have you got any idea to solve? Thanks in advance

1 Answer 1

0

I solved this issue in another post. I too needed to rotate by 90º and you are probably missing that the image is being mirrored. I hope it fixes your problem.

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 2, 2022 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.