建议数字识别建议、数字

2023-09-04 05:01:38 作者:一生醉笑

我正在写一个Android应用程序,从图片中提取数独谜题。在9x9的独网格中的每个单元,我需要确定它是否包含的数字1一个贯通9或为空。我有一个数独是这样开始:

我$ P $使用OpenCV的提取的个别数字的黑色和白色图像,然后把它们通过的的tesseract 。有一对夫妇的限制的tesseract,虽然:

的tesseract很大,包含了很多功能我不需要(即包括文字识别),和的需要的以英语培训数据的功能,我认为已去到设备的SD卡。至少我可以告诉它只能查找使用 tesseract.setVariable数字(tessedit_char_whitelist,123456789); 的tesseract经常misinter $ P $点一个个位数的数字字符串,通常包含换行符。它有时也只是简单的得到它错了。下面是从上面数独的几个例子:

我有三个问题:

有没有什么办法可以克服的tesseract的限制? 如果没有,什么是有用的,准确的方法来检测单个数字(不是k近邻),这将是实现在Android上可行的 - 这可能是一个免费的图书馆或DIY解决方案 如何提高pre-处理目标的方法?一种可能性,我认为是使用了细化算法,所建议的这个帖子,但我不会去打扰实现它,除非它会有所作为。 解决方案

我参加了一个类之一计算机视觉超级巨星谁是/是在数字识别算法排名第一。他真的坚持认为做数字识别的最好办法是...

  1。找一些手工标记的训练数据。
2.运行方向梯度直方图(HOG)的训练数据,并产生一种
    每幅图像的长,级联特征向量
3.给每个图像的HOG特征和它的标签到SVM
4.对于测试数据(一个数独谜题数字),运行HOG的数字,然后问
    支持向量机的数独题进行分类的HOG特征
 

OpenCV的一个 HOGDescriptor 对象,计算 HOG功能 。看看本文的建议如何调整HOG特征参数。任何SVM库应该做的工作...的CvSVM东西随OpenCV的应该就可以了。

有关训练数据,我建议使用 MNIST手写数字数据库,其中有数以千计的地面数字图片-truth数据。

澎湃新闻 专注时政与思想 ThePaper.cn

一个稍微硬一点的问题是画一个边界框出现在自然界的数字。幸运的是,它看起来像你已经找到了一个战略做边界框。 :)

I'm writing an Android app to extract a Sudoku puzzle from a picture. For each cell in the 9x9 Sudoku grid, I need to determine whether it contains one of the digits 1 through 9 or is blank. I start off with a Sudoku like this:

I pre-process the Sudoku using OpenCV to extract black-and-white images of the individual digits and then put them through Tesseract. There are a couple of limitations to Tesseract, though:

Tesseract is large, contains lots of functionality I don't need (I.e. Full text recognition), and requires English-language training data in order to function, which I think has to go onto the device's SD card. At least I can tell it to only look for digits using tesseract.setVariable("tessedit_char_whitelist", "123456789"); Tesseract often misinterprets a single digits as a string of digits, often containing newlines. It also sometimes just plain gets it wrong. Here are a few examples from the above Sudoku:

I have three questions:

Is there any way I can overcome the limitations of Tesseract? If not, what is a useful, accurate method to detect individual digits (not k-nearest neighbours) that would be feasible to implement on Android - this could be a free library or a DIY solution. How can I improve the pre-processing to target that method? One possibility I've considered is using a thinning algorithm, as suggested by this post, but I'm not going to bother implementing it unless it will make a difference.

解决方案

I took a class with one of the computer vision superstars who was/is at the top of the digit recognition algorithm rankings. He was really adamant that the best way to do digit recognition is...

1. Get some hand-labeled training data.
2. Run Histogram of Oriented Gradients (HOG) on the training data, and produce one
    long, concatenated feature vector per image
3. Feed each image's HOG features and its label into an SVM
4. For test data (digits on a sudoku puzzle), run HOG on the digits, then ask 
    the SVM classify the HOG features from the sudoku puzzle

OpenCV has a HOGDescriptor object, which computes HOG features. Look at this paper for advice on how to tune your HOG feature parameters. Any SVM library should do the job...the CvSVM stuff that comes with OpenCV should be fine.

For training data, I recommend using the MNIST handwritten digit database, which has thousands of pictures of digits with ground-truth data.

A slightly harder problem is to draw a bounding box around digits that appear in nature. Fortunately, it looks like you've already found a strategy for doing bounding boxes. :)