I
I
i_vovani2020-09-05 15:36:11
Python
i_vovani, 2020-09-05 15:36:11

What to do so that the tesseract can recognize the text?

Hello, after preprocessing the image, I have such an image and I need it to be recognized by pytesseract, how can I do this?
Here is the image:
5f5385df54a1f869388627.png
Here is the code:

src = cv2.imread('dot.png', cv2.IMREAD_COLOR)

    #Transform source image to gray if it is not already
    if len(src.shape) != 2:
        gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
    else:
        gray = src

    edges = cv2.Canny(gray,50,150)

    ret, thresh = cv2.threshold(edges, 127, 255, cv2.THRESH_BINARY)
    dilate = cv2.dilate(thresh,kernel,iterations=1)
    erode = cv2.erode(dilate,kernel,iterations=1)

    contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
    hierarchy = hierarchy[0]

    cv2.imshow('',erode)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-09-05
@i_vovani

you need to learn it on captcha)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question