1 / 19

Sudoku Downloader and Recognizer

Sudoku Downloader and Recognizer . Author: Pedro Evaristo González Sánchez. Main Activity(Portrait) . Recognizement. Custom View. Gaming. Backtracking. Board Downloader. Custom view. Paint and Canvas to draw , background , lines and numbers Adaptable ( OnSizeChanged )

rufina
Download Presentation

Sudoku Downloader and Recognizer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sudoku Downloader and Recognizer Author: Pedro Evaristo González Sánchez

  2. Main Activity(Portrait) Recognizement Custom View Gaming Backtracking BoardDownloader

  3. Custom view • Paint and Canvastodraw, background, lines and numbers • Adaptable ( OnSizeChanged) • EventsSelf-management( onTouchEvent, onKeypressed ) • InteractionwithMainActivity

  4. Custom View – Main Activity • MainActivityinstancesCustom View • Mainactivity set sensorial’smethods of theCustom View (Focusable…) • Whether a Buttonnumberispressed, MainActivityrecievesthe actual cell position iluminated • MainActivityupdatesthe Sudoku Board and orderthecustomviewto be paintedonDraw() and invalidate() )

  5. Class Sudoku (I) • Matrix [9][9] of Integers • Constructor overload ( String ) to implement the communication between activities • The class return a String which contains the sudoku board. This is very helpful for several situations. For innstance ( Bundle and Activities communication) • Neighbor checking ( row, column and block )

  6. Sudoku Class II ( Backtracking ) • If the actual Cell is (9,9) => Ends • If you find a number, go to the next cell ( Original Sudoku ) • For each value 1..9 • If neighbor checking is positive • Sudoku(i+1,j+1) • If you don’t find a candidate, restore and go back one cell

  7. Download Activity (I) • A way to update the app game • It exist a Sudoku board holded in a web server • “Good formed” Board within a *.txt file. • The goal is to rescue this board and take it to the Game

  8. Download Activity (II)

  9. 3. Sudoku Recognizer • 3.0 Android previous concepts • 3.1 Image Capture • 3.2 Image processing (OpenCV) • 3.3 Optical Chracter Recognition (OCR) • Tesseract

  10. 3.0 Android previous concepts • SDK and OpenCV Library (OpenCV) • NDK (NativeDeveloping Kit) ( Tesseract ) • Buildlibraries and referencethem in theapplication.

  11. 3.1 Image Capture • CallingtheIntent in charge of capturingimages of Android • Capture and savetheimage in a temporal file • Pre-processing => Findingthe balance betweengoodqualitiy and computability

  12. 3.2 Image Processing (I) • First controversy, the image is in perspective => the board is not a quad, is a trapezoid • The Main concern is a processing in two levels (RGB and GRAY)

  13. Image Processing (II) • Border’s detection • Next, searching the biggest contour within the image. (ROI)

  14. Image Processing (III) • Houghalgorithm and transformtofindtheboardslines • Two fundamental concepts in line processing: • Every single line will be deletepaintingthem of whiteorblack in each case (RGB and GRAY). • Checkifthestartpointorendpoint of line isinsidesome of thefourrectcorners of theimage

  15. Image Processing (IV) • Getting the matrix that defines the perspective transformation needed to extrapolate the corners of the board to the corners of the image • Apply a WarpPerspective Transformation with the matriz obtained.

  16. Image Processing (V) • At this point, the board is divided in equal cells to process each one of them

  17. Procesamiento de la Imagen (VI) • Single cell processing in paralell (RGB and Gray) bearing in mind Tesseracts requeriments. Equalizing Histogram Threshold Smooth + Dilate findContours()

  18. Tesseract ( OCR ) • ¡Don’t wait for a miracle!. You need an strong image processing • Delimiting dictionary to numbers (1..9) • For each number it is necessary releasing the memory allocated by the image and by the tesseracts object. We are on a phone and we’ve got less memory resources. Tesseract 6

  19. That’s all. Thank you!!

More Related