
AUTOMATED PUZZLE SOLVER USING IMAGE PROCESSING Project report submitted in fulfillment of the requirement for the degree of Bachelor of Technology In Computer Science and Engineering By Himanshu Malhotra (131219) Hitesh Jain (131224) Under the supervision of Dr. Pradeep Kumar Gupta To Department of Computer Science & Engineering and Information Technology Jaypee University of Information Technology Waknaghat, Solan-173234, Himachal Pradesh CERTIFICATE Candidates’ Declaration We hereby declare that the work presented in this report entitled “Automated Puzzle Solver Using Image Processing” in fulfillment of the requirements for the award of the degree of Bachelor of Technology in Computer Science and Engineering submitted in the department of Computer Science and Engineering, Jaypee University of Information Technology, Waknaghat is a genuine record of our own work carried out over a period from August 2016 to May 2017 under the supervision of Dr. Pradeep Kumar Gupta, Assistant Professor (Senior Grade) in Computer Science and Engineering department. The matter embodied in the report has not been submitted for the award of any other degree or diploma. Himanshu Malhotra (131219) Hitesh Jain (131224) This is to certify that the above statements made by the candidates are true to the best of my knowledge. Supervisor Name: Dr. Pradeep Kumar Gupta Designation: Assistant Professor (Senior Grade) Department name: Computer Science and Engineering Dated: i ACKNOWLEDGEMENT It gives us immense pleasure to present our knowledge-rich project, thanks for the continuous and patronage of people whose ceaseless cooperation made it possible, whose constant guidance and encouragement crown all efforts with success. We are grateful to our project guide Dr. Pradeep Kumar Gupta who made the way for us to move ahead through his suggestions and knowledge. We also thank our friends who have helped us in successful completion of the project. Date: Himanshu Malhotra (131219) Hitesh Jain (131224) ii TABLE OF CONTENTS S. No. Topic Page no. 1. Introduction 1 2. Literature Survey 5 3. System Development 31 4. Performance Analysis 42 5. Conclusion 49 iii LIST OF ABBREVIATIONS Abbreviation Word OCR Optical Character Recognition PNG Portable Network Graphics JPEG Joint Photographic Experts Group GIF Graphics Interchange Format DLX Dancing Links Algorithm iv LIST OF FIGURES S. No. Title Page No. 1. Example of Sudoku puzzle 1 2. System Architecture 31 3. Original image of Sudoku 32 4. Gray Scale Image of Sudoku 32 5. After applying Gaussian Blur and Adaptive Thresholding 33 6. Extracted Grid 34 7. Architecture of tesseract 36 8. Architecture of tesseract 36 9. Input image 37 10. Recognized digits output in notepad 38 11. Solution using backtracking 39 12. DFD Level 0 40 13. DFD Level 1 40 14. DFD Level 2 41 15. Memory taken by different algorithms 44 16. Time taken by Backtracking Algorithm 44 17. Time taken by Dancing Links 45 18. Sudoku Puzzle 45 19. Gray Scale 46 20. Gaussian Blur 46 21. Adaptive Thresholding 47 22. Extracting Grid 47 23. Thresholding the grid again 48 24. Extracting numbers and writing solution 48 v ABSTRACT In our project we proposed 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. vi Chapter – 1 INTRODUCTION 1.1 Introduction In real life, we run over Sudoku riddles of fluctuating trouble levels in daily papers and magazines. It is a typical relaxation action for many people. Be that as it may, it is watched that the arrangement and the solution is not generally promptly accessible for the user’s verification. By and large, individuals need to hold up the Sudoku puzzle till the following day to check the arrangements of the Sudoku. Henceforth our inspiration for this project was to build up an application on an android gadget for this reason. In our application, the client needs to catch a perfect picture of an unsolved Sudoku Puzzle, which then returns the total arrangement of the same. Figure 1.1: Example of Sudoku puzzle Sudoku is a justification based game with the target to complete a 9x9 cross section so that each line, each portion and each of the nine 3x3 boxes contain the numbers 1 through 9 with a unique number. The issue itself is a pervasive brainteaser yet can without a doubt be used as an algorithmic task, with similarities to the graph shading issue just with settled size and 1 conditions. The present day type of Sudoku was introduced in Japan in the eighties and has starting now and into the foreseeable future pulled in an impressive measure of programming architects and thusly there are a considerable measure of different Sudoku fathoming counts open on the Internet. Sudoku solvers are captivating because they are sensible employments of incredibly speculative issues, and a large number individuals think about them. 1.2 Problem Statement The assignment is to tackle the Sudoku grid in as less time as possible. It should be possible by researching diverse methods for Sudoku solving and contrasting them for the most productive arrangement. Sudoku itself can be tackled utilizing brute-force approach in a sensible measure of time as a rule, yet there are extraordinary situations where it requires a long investment to the brute-force method. In this manner our idea is to attempt to discover efficient calculations for all examples of the issue and assess them while utilizing the ideal solver to get the answer for the Sudoku puzzle. There are two primary limitations that decide the productivity of an ideal solver. They are Time utilization and Memory utilization whose level of fulfilment decides the nature of an ideal Sudoku solver. These imperatives as a rule fluctuate from calculation to calculation. To understand the Sudoku puzzle in however much less time as could be expected. It should be possible by exploring distinctive strategies for understanding Sudoku and looking at them for the most productive arrangement. Along these lines our assignment is to attempt to discover effective calculations for all occasions of the issue and assess them while utilizing the ideal solver to get the answer for the Sudoku grid in as less time as possible and taking as less memory as possible. 1.3 Objective The goal of this project is to click a picture from a mobile phone and send it to the server via Wi-Fi and then using that image we will explain Sudoku with the utilization of recursive 2 backtracking algorithm while following the rules and then the generated Sudoku image needs to be transferred back in the mobile phone via Wi-Fi The Constraints are as per the following: Sudoku puzzle can just contain the numbers 1 through 9. A position requirement: Only 1 number can possess a cell, otherwise the output will be wrong and it is an unsolvable Sudoku A push imperative: Only 1 example of a number can be in the column A segment requirement: Only 1 occasion of a number can be in a section An area requirement: Only 1 occasion of a number can be in an area 1.4 Methodology The process to tackle the Sudoku depends on a recursive backtracking methodology. We store the numbers taken from the grid in the picture, in a two dimensional matrix with the number 0 allocated to clear areas which doesn’t have any digit associated to them. To get an answer for the Sudoku grid, we recognize a clear area in the matrix. In light of Sudoku principles, we recognize a very tough task by repeating through the numbers 1-9. We then attempt to recursively show the matrix with this new number position. In the event that there are no more grid areas which should be filled, it means that the network is unsolvable, and we give back the unsolved matrix back to the fundamental calculations. Then again, on the off chance that we neglect to recursively discover an answer for a matrix, we backtrack and attempt an alternate number task for an area and take a chance at settling the network once more. On the off chance that all number assignments (1 to 9) are exhausted without finding an answer, we finish up with the conclusion that the matrix is unsolvable and in this way the solver will return false. For our motivations anyway, we accept that the picture taken by the client is a Sudoku grid and our calculation will dependably explain it regardless of the trouble level of the puzzle. The strategy for illuminating the method is partitioned into: Capturing a picture of Sudoku utilizing camera Sending it to the server for processing via Wi-Fi 3 Smoothing the picture and pre-preparing methods Grid discovery Grid Extraction Recognition of digits utilizing OCR Using different calculations to get the answer for Sudoku Comparison between various calculations utilized for tackling Sudoku Environment setup for Android usage Building the required capacities and class layouts for the application Generate the desired image of solved Sudoku grid Send the image back to the mobile phone via Wi-Fi An android powered mobile phone and a Sudoku grid image is required for the whole process.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages57 Page
-
File Size-