Coder Social home page Coder Social logo

sudoku_solver's Introduction

SUDOKU SOLVER

Overview

Sudoku Solver is an AI-powered project that uses computer vision techniques, deep learning, and backtracking algorithms to automatically solve Sudoku puzzles. The solver can take an image of a Sudoku puzzle as input, extract individual digits, recognize them using a deep learning model, and then apply a backtracking algorithm to find the correct solution.

Features

  • Image Processing: The solver uses OpenCV for image processing, including contour detection and perspective transformation, to extract and preprocess individual digits from the Sudoku puzzle image.

  • Deep Learning: Sudoku digits are classified using a trained neural network model, which accurately recognizes handwritten digits.

  • Backtracking Algorithm: The solver employs a backtracking algorithm to solve the Sudoku puzzle, checking for valid digits in each cell and backtracking when necessary to find the correct solution.

Dependencies

The Sudoku Solver relies on the following libraries:

  • OpenCV: For image processing and contour detection.
  • TensorFlow: For deep learning and neural network model inference.
  • Keras: For building and training the digit recognition model.
  • request: Used to fetch the image from the smartphone's camera server (IP Webcam) using the provided URL.(no need if using laptop' webcam)
  • imutils: Used for resizing the image captured from the smartphone's camera.(no need if using laptop' webcam)

Make sure you have these libraries installed before running the solver.

NOTE: If (like me) you do not have access to a good webcam on your laptop or an external webcam, you can use your smartphone's camera to capture the Sudoku puzzle image and then utilize the application ("IP Webcam") to stream the camera feed to the laptop.

The solver.py script can be modified to accommodate both scenarios:

For smartphone camera usage:

import cv2 as cv
import numpy as np
import tensorflow as tf
import requests
import utils
(URL for the IP Webcam server stream)
url = "http://your_phone_ip_address:8080/shot.jpg"
Rest of the code remains the same as in the original solver.py script ...

For Laptop Webcam usage:

import cv2 as cv
import numpy as np
import tensorflow as tf
OpenCV function to access the laptop's webcam
cap = cv.VideoCapture(0)
Rest of the code remains the same as in the original solver.py script...

Demo:

WhatsApp Image 2023-07-29 at 21 37 53

Contributing

Contributions to Sudoku Solver are welcome! If you find any issues, have ideas for improvement, or want to add new features, feel free to open an issue or submit a pull request :)

Contact

For any inquiries or questions regarding the Sudoku Solver, feel free to contact me at [email protected]

Happy Sudoku Solving!

sudoku_solver's People

Contributors

aryann15 avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.