Visual Sudoku Application

Back to Tutorials | Use cases

Brief description

An automatic Sudoku puzzle solver using OpenCV, Deep Learning, and Optical Character Recognition (OCR).

Available

Software

Software adapted by Simon de Givry (@ INRAE, 2022) in order to use toulbar2 solver, from a tutorial by Adrian Rosebrock (@ PyImageSearch, 2022) : GitHub code https://forgemia.inra.fr/thomas.schiex/cost-function-library/-/tree/master/crafted/visualsudoku

As an APK

Based on this software, a ‘Visual Sudoku’ application for Android has been developed to be used from a smartphone.

See the detailed presentation (description, source, download…).

The application allows to capture a grid from its own camera (‘CAMERA’ menu) or to select a grid among the smartphone existing files (‘FILE’ menu), for example files coming from ‘DCIM’, in .jpg or .png formats. The grid image must have been captured in portrait orientation. Once the grid has been chosen, the ‘Solve’ button allows to get the solution.

Fig.1 screen_mainmenu Fig.2 screen_grid Fig.3 screen_solution

  • Fig.1 : Screen of main menu

  • Fig.2 : Screen of the grid to be solved

  • Fig.3 : Screen of the solution (in yellow) found by the solver

Examples of some input grids and their solved grids

As a Web service

The software is available as a web service. The visual sudoku web service, hosted by the ws web services (based on HTTP protocol), can be called by many ways : from a browser (like above), from any softwares written in a language supporting HTTP protocol (Python, R, C++, Java, Php…), from command line tools (cURL…)…

  • Calling the visual sudoku web service from a browser :

  • Example of calling the visual sudoku web service from a terminal by cURL :

    Commands (replace mygridfilename.jpg by your own image file name) :

    curl --output mysolutionfilename.jpg -F 'file=@mygridfilename.jpg' -F 'keep=40' -F 'border=15' http://147.100.179.250/api/tool/vsudoku
    
  • The ‘Visual Sudoku’ APK calls the visual sudoku web service.