cross-posted from: https://lemmy.world/post/961924

A script in bash in combination with a script in C can help you solve a sudoku puzzle in a png file.

https://gitlab.com/christosangel/sudoku-solver-ocr

You can see the script in action in this video.

The main dependency is tesseract OCR, responsible for the oprical character recognition.

Another important dependency is imagemagick, responsible for the necessary image manipulation.

The file selection of the png image is done with zenity.

Feel free to give your feedback.

  • @marswarrior
    link
    English
    2
    edit-2
    1 year ago

    Very cool! Is it possible to have imagemagick fill out the png after calculating the result?

    Something like convert -background white -fill black -font Arial -pointsize 24 -size 300x caption:@output.txt output.png

    If we remove the background with -background transparent -fill black

    Then merge the output with the result with convert background.png overlay.png -composite output.png it might work

    • christosOP
      link
      English
      21 year ago

      Thanks! It don’t see why not is not doable, writing out the found data from the C script to a file,parse the file to get the value of each square. From there, either create a label for each square and rewrite the whole puzzle with append, or fill with layers. This might work.