Last updated
Was this helpful?
Was this helpful?
import tesserocr
from PIL import Image
image = Image.open('code.jpg')
result = tesserocr.image_to_text(image)
print(result)JR42import tesserocr
print(tesserocr.file_to_text('image.png'))import tesserocr
from PIL import Image
image = Image.open('code2.jpg')
result = tesserocr.image_to_text(image)
print(result)FFKTimage = image.convert('L')
image.show()image = image.convert('1')
image.show()image = image.convert('L')
threshold = 80
table = []
for i in range(256):
if i < threshold:
table.append(0)
else:
table.append(1)
image = image.point(table, '1')
image.show()import tesserocr
from PIL import Image
image = Image.open('code2.jpg')
image = image.convert('L')
threshold = 127
table = []
for i in range(256):
if i < threshold:
table.append(0)
else:
table.append(1)
image = image.point(table, '1')
result = tesserocr.image_to_text(image)
print(result)PFRT