Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

python - Pytesseract issues parsing large+bold text

I am trying to parse text from an image of graded comic books, tesseract seems to be able to parse the smaller text on the image somewhat, but not the largest text on any image i send it.

Here is the code for converting the image. It basically just makes it into black and white.

gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY)
threshold_img = cv.threshold(cv.bilateralFilter(
    threshold_img, 5, 75, 75), 0, 255, cv.THRESH_BINARY + cv.THRESH_OTSU)[1]

# 6,11,12 perform well, i have tried every psm config
details = pytesseract.image_to_data(
    threshold_img, output_type=Output.DICT, lang='eng', config="--psm 6")

I have been able to successfully parse the text when I crop the image to be JUST the grade "label".

One important note is that the grading label can be of different sizes and text can be gray or gold too.

example image, label that needs to be processed is the "8.0" in the top left

If pytesseract would not work in this case, please suggest another image processing tool that would work better in this case! Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...