Java OCR检测数独网格数字

时间:2013-03-28 00:53:42

标签: java ocr tesseract

我使用Tess4j进行光学识别,它对于我给我的程序提供的几乎所有图片都非常有效。我在81个盒子里切割了Sudoku扫描网格。但是,当我拿一个包含数字的正方形时,Tess4j无法检测到该数字。我不知道为什么,数字在白色背景上是黑色的。有人可以帮帮我吗?

感谢您的回复!

1 个答案:

答案 0 :(得分:0)

您可以尝试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.