I am working on a Kivy App that takes an image through:
texture = self.camera.texture
size = texture.size
pixels = texture.pixels
The information above is used for the following function:
import numpy
from PIL import Image
from pyzbar.pyzbar import decode
def convert_qr(size, pixels):
pil_image = Image.frombytes(mode='RGBA', size=size,data=pixels)
#This returns an array of length 480
numpypicture = numpy.array(pil_image)
# PC returns a list of 1
# Android returns an empty list
barcodes = decode(numpypicture)
#barcode_info = barcodes[0].data.decode('utf-8')
return str(len(barcodes))
Problem
I know the problem comes from this line:
barcodes = decode(numpypicture)
but i don't know how to fix it. When I use the computer camera and run it the function returns '1' for str(len(barcodes)). When I use the android camera, the function returns '0'. This means, the barcodes = decode(numpypicture) does not decode the 'numpypicture' properly.
I know for a fact that 'numpypicture' variables works because both PC and Android camera return 480 when i return len(numpypicture). It is only after the barcodes = decode(numpypicture) line that the result between PC and Android Camera is different. (They are scanning the same QR Image)
Any idea how i might debug this?