*I also tried Rotation but its still not working.* *These are the preprocessing steps that i used:*
import cv2 import pytesseract import numpy as np from scipy import ndimage img = cv2.imread('voucher.png') img = cv2.bitwise_not(img) img = cv2.resize(img, None, fx=1.2, fy=1.2, interpolation=cv2.INTER_CUBIC) img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) kernel = np.ones((1, 1), np.uint8) img = cv2.dilate(img, kernel, iterations=1) img = cv2.erode(img, kernel, iterations=1) img = ndimage.rotate(img, -20) cv2.imwrite("changed.png",img) pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' print(pytesseract.image_to_string(img)) abey...@gmail.com schrieb am Montag, 31. Oktober 2022 um 10:46:59 UTC+1: > Did you try all the preprocessing steps? Rotation / Deskewing ? I think > Tesseract finds it difficult to identify skewed images. > > On Mon, Oct 31, 2022 at 1:17 PM nabil-ak <akir...@gmail.com> wrote: > >> Hello, >> >> I want to detect a code (combination of characters) on an image in python. >> >> I already tried EasyOCR <https://github.com/JaidedAI/EasyOCR> and Tesseract >> Open Source OCR Engine <https://github.com/tesseract-ocr/tesseract> but >> noone could detect the characters. >> >> I also tried to preprocess the picture by inverting the white font to a >> black font and painting the background white to make it for the engine >> easier to detect the characters. >> >> *What am i doing wrong?* >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "tesseract-ocr" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to tesseract-oc...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/tesseract-ocr/2e764275-4992-495f-b0ac-ffe668254231n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/tesseract-ocr/2e764275-4992-495f-b0ac-ffe668254231n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "tesseract-ocr" group. To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/fa7f616c-6f16-4691-ab9e-bd333633b4d6n%40googlegroups.com.