1

I'm having trouble reading the text correctly within this image:

this image

using cv2 and pytesseract. The code I have is here:

import pytesseract
import cv2

image = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
(h, w) = image.shape[:2]
img = cv2.resize(image, (w*2, h*2))
thresh = cv2.threshold(img, 180, 255, cv2.THRESH_BINARY)[1]

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

#convert image to string
data = pytesseract.image_to_string(thresh, lang='eng', config=r'--oem 3 --psm 6')
print(data)

The current code outputs incorrect text. It shows 44 instead of 4A.

| @- JobNumber: 44015100
H i» Relative Thickness: 0.21488
Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
potatopainting
  • 103
  • 1
  • 9

0 Answers0