Giter Club home page Giter Club logo

mazesolver's Introduction

MazeSolver

Solve the maze problem with the image input using OpenCV image processing library and Djikstra graph short path algorithm

In this project, we have an image from a maze problem as the input. After binarization of the image, the skeleton of the image is found by "thinning.cpp". It means that we remove the true pixels until the paths remain with just one pixel thickness.

Then we should find the "Enter" and "Exit" points of the maze problem. For this reason, it is just necessary to find the Endpoints of the paths in the borders of the image. So the outer pixels in the border of the image is filled with True values so that the "Enter" and "Exit" point can be findable as the endpoint. Then "endpoints.cpp" is used to find them. Two points in the borders of the image are acceptable as "Enter" and "Exit".

After that, we use "DjikstraShortPath.cpp" to find the shortest path between "Enter" and "Exit" points. in this function, we model the skeleton binary image as a graph. True pixels are the nodes of the graph and there is an edge between that pixel and true pixels in its 8-connected neighborhood. It is obvious that in this project, the weights of the edges should be equal (I assumed them 1), but you can change them to make some heuristic and difficult Maze Solvers (yeah, Fork this repository to do that!). The best path between "Enter" and "Exit" Points of the maze problem is saved in a vector of cv::Point (OpenCV object for pixel point of the image). I visualized it in the OpenCV image viewer that a red line starts from the "Enter" point toward the "Exit".

To run this project, first, you should install and include OpenCV library (Download from here: https://opencv.org/) Feel free to ask your questions about this project (and everything else about the world, if I know about it!): P.ghasemi94 AT gmail DOT com

Peyman Ghasemi - January 2018 - Tehran, Iran

mazesolver's People

Contributors

peymvn avatar

Watchers

Aditya Ganapathi 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.