Solve Sudoku puzzle from a screenshot (sudoku-solver-ocr in C, bash)

cross-posted from: 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, (edited )
@marswarrior@lemmy.world avatar

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

christos,
@christos@lemmy.world avatar

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • Socialism
  • KbinCafe
  • TheResearchGuardian
  • Ask_kbincafe
  • oklahoma
  • feritale
  • SuperSentai
  • KamenRider
  • All magazines