Using python pytesseract to convert an image to text -
i'm having bit of trouble outputting words text-image .txt file.
import pytesseract pil import image, imageenhance, imagefilter text = pytesseract.image_to_string(image.open("book_image.jpg")) file = open("text_file","w") file.write(text) print(text) the code reads image file , prints out words on image works fine. problem when try take text , write file, following error;
unicodeencodeerror: 'ascii' codec can't encode character u'\u2019' in position 366: ordinal not in range(128)
could please explain how can convert variable text string?
Comments
Post a Comment