1

Getting Bad image data when trying to detect text in a part (numpy array rectangle out) of an opencv image. When I try to convert the resulting base64 string online it works without issues (here for example)

im = Image.fromarray(narray.astype("uint8"))
rawBytes = io.BytesIO()
im.save(rawBytes, "PNG")
rawBytes.seek(0)  # return to the start of the file
image = vision.types.Image(content = b64encode(rawBytes.read()))
resp = client.text_detection(image = image)

I found this on the topic but why would I need to do that?

Any ideas what I could be doing wrong?

K41F4r
  • 1,443
  • 1
  • 16
  • 36

0 Answers0