GOAL: I need a cleaned image to use pytesseract and get the text from it.
I pass this image into gray.
I use cv2.adaptiveThreshold
to deal with the reflection problematic. But it doesn’t work well.
My text became less readable and pytesseract can’t read it. I don’t know how to upgrade my image.
import cv2
path = "path/to/image.jpg"
rgb_img = cv2.imread(path)
gray_img = cv2.imread(path, 0)
tresholded_img = cv2.adaptiveThreshold(gray_img, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 19, 1)
cv2.imshow('rgb', rgb_img)
cv2.imshow('gray', gray_img)
cv2.imshow('tresholded', tresholded_img)
cv2.waitKey(0)