python openCV to solve sodoku via OCR

copyright (C) 2011-2017 iesensor.com

Using  python-sudoku 0.13  generate sudoku image, and solve the parsed puzzle;

Using Tesseract 3  python wrapper to do digit,  but it will not be sucessful for all times.

download the package pythonsudoku-0.13-orcsudoku, extract to anywhere,  cd pythonsudoku-0.13/ocrsudoku/,  run:  python  cvsudoku.py <inputimagefile>

Screenshot from 2013-01-24 15_20_27

Screenshot from 2013-01-24 15_21_03

Python  to solve sudoku using tesseract and OpenCV

—————————————————-
Copyright
Qingfeng Xia  @ iesensor.com     2012
To share info about sensor and robot
License: GPLv2
—————————————————-
1 Reference to blogs
(1) “OpenCV sudoku, part one”,  stackoverflow.com

(2) Another blog finish the digit OCR by OpenCV ()
http://www.codeproject.com/Articles/238114/Realtime-Webcam-Sudoku-Solver

2 Test Environment:
Ubuntu 12.04, Tesseract 3.01,  OpenCV 2.3 all with Python bilnding
pythonsudoku-0.13
this folder “ocrsudoku”, should be put under the  folder of “pythonsudoku-0.13” as it is shipped

packages depends:   python-opencv  python-tesseract

 

3. Usage:
change folder into “ocrsudoku”
(1)  ./cvsudoku.py ,  or by double clicking, it will solve random generated sudoku and display result
or  in terminal and show result images.

(2)./cvsudoku.py   sudoku_unsolved.png

4. Problems during programming:
(1)The data type to represent the image in OpenCV 1.x API
(2)Tesseract python binding support OpenCV 2.3 with old style python-opencv binding,
but it  supports new style API cv2.* ,

5. limitations:
(1)Using  python-sudoku 0.13  generate sudoku image, and solve the parsed puzzle;
Therefore, tilted grid will not be recognized in this version. ( only horizontal and vertical grid is acceptable)

(2)Using Tesseract 3  python wrapper to do digit,  but it will not be sucessful for all times.
python  pythonsudoku-0.13\ocrsudoku\cvsudoku.py <inputimagefile>

BSD documentation licensed Free for non-commercial usage only
Author: Qingfeng XIA copyright (C) 2011-2013 http://www.iesensor.com
please keep the original link in your reference. http://www.iesensor.com/blog/2013/01/24/python-opencv-to-solve-sodoku-via-ocr/
This entry was posted in Download, Programming, Robot. Bookmark the permalink.