Why isn't pytesseract recognizing this image?

55 views Asked by At

It can read other images fine, it just can not read this one

enter image description here

import numpy as np
from pytesseract import pytesseract
import cv2
import numpy as np
from PIL import Image
import os

path_to_tesseract = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

pytesseract.tesseract_cmd = path_to_tesseract


img = cv2.imread(r'C:\Users\Owner\Desktop\Coding\PNGs\tugteam project\tugteam2.png')

grayImage = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(thresh, img) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY)

img = cv2.bitwise_not(img)


img = cv2.resize(img, (600, 400))



cv2.imshow('asd',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

text = pytesseract.image_to_string(img)
print(text)


I tried resizing the image, converting it to grayscale b/w w/b nothing will work.

0

There are 0 answers