Home > front end >  Trouble detecting numbers using pytesseract using a pixeled image
Trouble detecting numbers using pytesseract using a pixeled image

Time:02-05

I am trying to detect/read the number in the image below. I apply a mask to the image (also shown below), and come back with a rather pixeled set of numbers. The only method for me to retrieve these numbers is there reading them from the image. any ideas on how to do that? I have tried pytesseract but it doesnt seem to work for the small/pixeled image I am using.

I am using Python 3.9, and CV2 (and pytesseract when I used it briefly). The code I used to apply the mask is also below.

upper_limit = np.array([0,255,255]) #Tried using a different lower limit, but all produced a black screen result besides this lower_limit = np.array([0,0,0]) mask = cv.inRange(image, lower_limit, upper_limit)

I also tried applying a Blur on the image and a Canny but the results were worse if anything.

enter image description here

import cv2
import numpy as np

img = cv2.imread('text_921.png')

lower = (254,254,254)
upper = (255,255,255)
thresh = cv2.inRange(img, lower, upper)

cv2.imwrite('text_921_thesh.png', thresh)

cv2.imshow('thresh', thresh)
cv2.waitKey(0)

Result:

enter image description here

  • Related