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 )

morgan
Télécharger la présentation

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. MainActivity(Portrait) Recognizement Custom View Gaming Backtracking BoardDownloader

  3. Customview • Paintand Canvastodraw, background, lines and numbers • Adaptable ( OnSizeChanged) • EventsSelf-management( onTouchEvent, onKeypressed ) • InteractionwithMainActivity

  4. Custom View –MainActivity • 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. ClassSudoku (I) • Matrix[9][9] of Integers • Constructor overload( String) toimplementthecommunicationbetweenactivities • Theclassreturn a Stringwhichcontainsthe sudoku board. Thisisveryhelpfulforseveralsituations. Forinnstance( Bundleand Activitiescommunication) • Neighborchecking( row, column and block )

  6. Sudoku Class II ( Backtracking ) • Ifthe actual Cellis(9,9) => Ends • Ifyoufind a number, gotothenextcell ( Original Sudoku ) • Foreachvalue1..9 • Ifneighborcheckingis positive • Sudoku(i+1,j+1) • Ifyoudon’tfind a candidate, restore and go back onecell

  7. DownloadActivity (I) • A waytoupdatetheappgame • Itexist a Sudoku boardholded in a web server • “Goodformed” Boardwithin a *.txt file. • Thegoalistorescuethisboard and takeittotheGame

  8. DownloadActivity (II)

  9. 3. Sudoku Recognizer • 3.0 Androidpreviousconcepts • 3.1 Image Capture • 3.2 Imageprocessing(OpenCV) • 3.3 OpticalChracterRecognition (OCR) • Tesseract

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

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

  12. 3.2 ImageProcessing (I) • Firstcontroversy, theimageis in perspective=> theboardisnot a quad, is a trapezoid • TheMainconcernis a processing in twolevels (RGB and GRAY)

  13. ImageProcessing (II) • Border’sdetection • Next, searchingthebiggestcontourwithintheimage. (ROI)

  14. ImageProcessing (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. ImageProcessing (IV) • Gettingthematrixthat defines theperspectivetransformationneededtoextrapolatethecorners of theboardtothecorners of theimage • Apply a WarpPerspectiveTransformationwiththe matriz obtained.

  16. ImageProcessing (V) • At thispoint, theboardisdivided in equalcellstoprocesseachone of them

  17. Procesamiento de la Imagen (VI) • Single cellprocessing in paralell (RGB and Gray) bearing in mindTesseractsrequeriments. Equalizing Histogram Threshold Smooth + Dilate findContours()

  18. Tesseract ( OCR ) • ¡Don’twaitfor a miracle!. Youneedanstrongimageprocessing • Delimitingdictionarytonumbers(1..9) • Foreachnumberitisnecessaryreleasingthememoryallocatedbytheimage and bythetesseractsobject. We are on a phone and we’vegotlessmemoryresources. Tesseract 6

  19. That’sall. Thankyou!!

More Related