Recognising numbers in sudoku

447 views
Skip to first unread message

agentbond009

unread,
Oct 30, 2020, 10:22:49 AM10/30/20
to tesseract-ocr
hello. I am working on a project, i was wondering if tesseract is an OCR can it read the no.s from a sudoku.
thanks

Jean-Marc Spaggiari

unread,
Oct 30, 2020, 10:27:19 AM10/30/20
to tesser...@googlegroups.com
Hi,

Did you give it a try?

Try to have the numbers in white in black in a withe background. Are you able to get each cell separately?

JM

Le ven. 30 oct. 2020 à 10:22, agentbond009 <kshit...@gmail.com> a écrit :
hello. I am working on a project, i was wondering if tesseract is an OCR can it read the no.s from a sudoku.
thanks

--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/4abe9a73-9543-4a5b-b29e-a917874378f8n%40googlegroups.com.

agentbond009

unread,
Nov 6, 2020, 10:21:05 AM11/6/20
to tesseract-ocr
sorry for the late reply
I have done the thresholding part by using opencv and converted the whole image to gray
and still stuck with recognising the digits. i was thinking to use clear_border from skimage.

Jean-Marc Spaggiari

unread,
Nov 6, 2020, 10:26:25 AM11/6/20
to tesser...@googlegroups.com
Is the image always the same size? Can you cut the columns to remove them and keep just the numbers?

agentbond009

unread,
Nov 15, 2020, 6:25:49 AM11/15/20
to tesseract-ocr
sudoku_output.jpgyes  i think the image is always the same size but i am not able to cut out the columns(still figuring out ). Like the image below is the result after thresholding. The problem is to reduce the noise(all depends on quality) like for example if the pic is of bad quality like this one, then i think the ocr will mess it up.
there are two pics for comparision.
sudoku_output.mp4

Martin Läuter

unread,
Nov 15, 2020, 10:26:35 AM11/15/20
to tesseract-ocr
Hi,
  Someone did some (apparently) solid sudoku solving without tesseract, see https://blog.scottlogic.com/2020/01/03/webassembly-sudoku-solver.html. And the explanation is not bad either.
  Hope that helps,
Martin.

agentbond009

unread,
Nov 16, 2020, 8:30:16 AM11/16/20
to tesseract-ocr
Thanks Martin Läuter  for the tutorial. But still i am gonna use tesseract for this bc i don't think my PC will handle tenserflow.

Jean-Marc Spaggiari

unread,
Nov 16, 2020, 8:37:15 AM11/16/20
to tesser...@googlegroups.com
If the pictures are all the same size, using ImageMagick you can most probably just cut each cell, pad it with black and send it back to tesseract. Just make sure to keep value only when there is a high confidence or enough "white" pixels?

Lorenzo Bolzani

unread,
Nov 16, 2020, 9:21:53 AM11/16/20
to tesser...@googlegroups.com

agentbond009

unread,
Nov 16, 2020, 10:03:15 AM11/16/20
to tesseract-ocr

Martin Läuter

unread,
Nov 16, 2020, 10:15:54 AM11/16/20
to tesseract-ocr
Remember, it's a website, that is live-solving the sudoku! Tensorflow.js is pretty lightweight, and you only need it to evaluate the number recognition model. You don't need to train the model (the trained weights are checked in the repository, AFAICT) nor install TensorFlow at all.
  I don't say you should absolutely use that webassembly project, but there is nothing to be afraid there, the author did a pretty good job of preparing and documenting everything.
  Greetings,
Martin.
Reply all
Reply to author
Forward
0 new messages