
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A project where the team developed a Sudoku solver using image processing and Optical Character Recognition (OCR) with Tesseract. The goal was to extract and recognize Sudoku puzzle elements, process the grid, and provide a digital solution. The team used Python, Tesseract, and specific hardware requirements.
Typology: Lab Reports
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Submitted by:
Department of CSE/IT Jaypee Institute of Information Technology University, Noida
In our project we propose a method of detecting and recognizing the elements of a Sudoku Puzzle and providing a digital copy of the solution for it. The method involves a vision-based sudoku solver. The solver is capable of solving a sudoku directly from an image captured from any digital camera. After applying appropriate pre-processing to the acquired image, we use efficient area calculation techniques to recognize the enclosing box of the puzzle. A virtual grid is then created to identify the digit positions. Tesseract OCR (optical character recognition) engine is used as a method for digit recognition. The actual solution is computed using a backtracking algorithm. Experiments conducted on various types of sudoku questions demonstrate the efficiency and robustness of our proposed approaches in real-world scenarios. The algorithm is found to be capable of handling cases of translation, perspective, illumination gradient, scaling, and background clutter
I would like to place on record my deep sense of gratitude to Nitin Shukla, Professor, Jaypee Institute of Information Technology, India for his generous guidance, help and useful suggestions. I express my sincere gratitude to Dr Mukesh Saraswat, Dept. of Computer Science and Engineering, for his stimulating guidance, continuous encouragement and supervision throughout the course of present work. I also wish to extend my thanks to Samarth Sajwan and other classmates for their insightful comments and constructive suggestions to improve the quality of this project work. Signature(s) of Students Abhishek Raghav 9918103001 Ruchit Parmar 9918103019 Sarthak Sharma 9918103023 Rishul Oberoi 9918103017
We hereby declare that this submission is our own work and that, to the best of our knowledge and beliefs, it contains no material previously published or written by another person nor material which has been accepted for the award of any other degree or diploma from a university or other institute of higher learning, except where due acknowledgment has been made in the text. Place: Jaypee Institute of Information Technology, Noida Date: 7 May, 2021 Name: Abhishek Raghav Enrolment no.: Name: Rishul Oberoi Enrolment no. : Name: Ruchit Parmar Enrolment no.: 9918103019 Name: Sarthak Sharma Enrolment no.:
The task is to solve the sudoku puzzle in as much less time as possible. It can be done by investigating different techniques for solving sudoku and comparing them for the most efficient solution. Sudoku itself can be solved using brute-force in a reasonable amount of time in most cases, but there are special cases where it takes a long time to brute-force. Therefore, our task is to try to find efficient algorithms for all instances of the problem and evaluate them while using the optimal solver to get the solution for the sudoku puzzle. There are two main constraints that determine the efficiency of a optimal solver. They are Time consumption and Memory consumption whose degree of satisfaction determines the quality of a optimal sudoku solver. These constraints usually vary from algorithm to algorithm. 2.1 Objectives The objective of this project is to solve sodoku with the use of recursive back tracking algorithm while satisfying the game constraints. Constraints:
Requirement Analysis 6.1 Functional Requirement 6.1.1System Requirement Software Python Tesseract Hk Jh Hardware Processor i5 or above R.A.M at least 8 GB G.P.U 6.2 Non- Functional Requirement Usability: - The implementation should be such that it can be used to optimize their local problems. Reliability: - The code should be such that it produces accurate result for any sudoku problem. Performance: - The code should be fast enough to replace other optimization techniques that are being currently used. The code’s throughput should be high and and also the time utilisation should be adequate. Supportability: - The code is implemented in the manner that it can run on any operating system. Implementation: - The code has to run on a supportive environment that is it can run on multiple platforms and producing accurate results. Interface: - The interface would be such that it is relevant to all users and it is very easy enough for them to learn how to use it and how to use it in daily life without having any major problems.
Original image of Sudoku 7.1.1 Smoothing the image and Adaptive thresholding The input image is first filtered with a low-pass Gaussian filter of 5x5 window size. The reason for this is that it smoothens out sharp projections and other high frequency components in the image. Also it helps in getting better results subsequently. It takes care of any jagged edge clutter that appears after adaptive Chapter 4 Gray Scale Image of Sudoku thresholding, thereby resulting in robust grid corner extraction. It was also observed that performing adaptive thresholding on the image without the smoothing filter gave broken digits. After blurring, the digits obtained were clean and complete, which could be used for digit recognition. Once smoothed, the image is passed through an Adaptive thresholding algorithm. The reasoning behind this is that there may be an illumination gradient (for example, due to shadows of the human capturing the images with the mobile phone), across
grid.jpg This approach, gave very good results in terms of grid detection. It removes any clutter outside the grid and isolates the Sudoku grid accurately and eases the rest of our algorithm. The extracted grid is shown in fig. Recognition of digits
Now that we obtained the extracted grid, our next task is to locate the digit positions in the puzzle grid and recognize them. For this we use tesseract OCR engine. 8.1 Tesseract OCR engine Tesseract is an open-source optical character recognition (OCR) engine originally developed at HewlettPackard between 1985 and 1995.Since HP had independently-developed page layout analysis technology that was used in products, (and therefore not released for open- source) Tesseract never needed its own page layout analysis. Tesseract therefore assumes that its input is a binary image. Processing follows a traditional step-by-step pipeline. The first step is a connected component analysis in which outlines of the components are stored. This was a computationally expensive design decision at the time, but had a significant advantage: by inspection of the nesting of outlines, and the number of child and grandchild outlines, it is simple to detect inverse text and recognize it as easily as black-on-white text. Tesseract was probably the first OCR engine able to handle white-on-black text so trivially. At this stage, outlines are gathered together, purely by nesting, into Blobs. Blobs are organized into text lines, and the lines and regions are analysed for fixed pitch or proportional text. Text lines are broken into words differently according to the kind of character spacing. Recognition then proceeds as a two-pass process. In the first pass, an attempt is made to recognize each word in turn. Each word that is satisfactory is passed to an adaptive classifier as training data. The adaptive classifier then gets a chance to more accurately recognize text lower down the page. Since the adaptive classifier may have learned something useful too late to make a contribution near the top of the page, a second pass is run over the page, in which words that were not recognized well enough are recognized again.
Input in command promt
: Recognised digits output in notepad
Solution using backtracking Implementation