我使用 Tess4j 进行光学识别,它几乎适用于我提供给我的程序的图片。我将数独扫描网格切割成 81 个盒子。但是,当我取一个包含数字的正方形时,Tess4j 无法检测到该数字。我不知道为什么,数字在白色背景上是黑色的。谁能帮帮我?
感谢您的回复!
您可以尝试 Tesseract 必须获得的各种页面分割模式 (PSM) 以获得最佳结果。
pagesegmode values are:
0 = Orientation and script detection (OSD) only.
1 = Automatic page segmentation with OSD.
2 = Automatic page segmentation, but no OSD, or OCR
3 = Fully automatic page segmentation, but no OSD. (Default)
4 = Assume a single column of text of variable sizes.
5 = Assume a single uniform block of vertically aligned text.
6 = Assume a single uniform block of text.
7 = Treat the image as a single text line.
8 = Treat the image as a single word.
9 = Treat the image as a single word in a circle.
10 = Treat the image as a single character.