1

I'm working with tesseract in android using tess-two wrapper. I've read the documentation about the library, but I'm facing a problem to regconize a square in my image. I'd like to recognize the outermost square in a sudoku board for instance.

There is an example in opencv but I cannot find something for tesseract.

Community
  • 1
  • 1
Gabriel Muñumel
  • 1,640
  • 5
  • 29
  • 50

1 Answers1

2

Tesseract is an OCR framework. It is useful for recognising characters and words in an image. For a sudoku board, you have two main problems:

  1. Recognise the outline of the game grid and the 9 rows and columns.
  2. Recognise the digits which have already been filled in.

Locating the Sudoku grid can be done by finding the corners, or possibly the edges in the image using line detection or corner detection algorithms; you should try to Google Hough Lines or Corner Detection.

The grid may not actually be square in your image if you are holding the camera at an angle so you will also need to transform the shape into a square before processing. You should Google Homography.

Assuming that you locate the grid and are able to transform it to a square, you can now find each of the row and columns. At this point you can examine each cell, one at a time to see if it's empty or contains a digit. If it contains a digit, you need to work out which one.

Now you could use Tesseract for this final stage but it's massive overkill. A simple template matching approach which you could build yourself would be sufficient.

Once you have done the background research above, you will be able to pick a framework or library which supports the operations your need. OpenCV is a very strong contender in this space and there is a lot of support for it here and on the web but you really need to understand the problem a lot better before picking a tool to solve it.

Dave Durbin
  • 3,339
  • 18
  • 31
  • Yes, I'm noob in image recognition. I thought I only need to recognize the text and Tesseract is good for that, but by the time I realized I also need to check the squares, corners, boards, so opencv is more suitable in this case. Thanks for your answer. I'm following the same strategy you described. Cheers. – Gabriel Muñumel May 08 '15 at 09:05
  • Good luck - it's a great project to start with – Dave Durbin May 08 '15 at 09:07