File Exchange

image thumbnail

maze_solution

version 1.0.0.0 (185 KB) by Image Analyst
Solves mazes using mathematical morphology - find the route through the maze.

35 Downloads

Updated 06 Apr 2010

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This demo works for "perfect mazes." A perfect maze is defined as a maze which has one and only one path from any point in the maze to any other point. This means that the maze has no inaccessible sections, no circular paths, and no open areas. A perfect maze should have only 2 walls (I believe). No searching or optimization methods (such as A* or dynamic programming) are used - only morphology and standard image processing methods. Only tested for 8 bit integer color and monochrome images.

Demo mazes are included, but you can specify your own maze image. Maze images should have dark walls on a light background. Maze may be surrounded by white, or go right out to the edge of the image and have the outer wall be the outer boundary of the image. The maze image should not include text or pictures, like arrows, animals, etc. -- it should include the maze walls only.

Comments and Ratings (16)

thank you sir

amazing!

thank you very very much:)

Celso Milne

Umar Farooq

Tian

Tian (view profile)

Scott

Scott (view profile)

Well done! Thank you.

Awesome one Sir!

lee woon joo

good!!

Iman Ansari

Ranjan Keshav

Extraordinary.... Great work !!!!

Benjamin

Love it.

Image Analyst

Cris: You've obviously taken it a step further with some nice improvements to make it more robust and handle additional types of complicated mazes. Nice work!

Abdul Basit

Excellent idea of using image processing for the solution.

Brilliant !!!

Cris Luengo

Nice!
I've got some alternative solutions: http://www.cb.uu.se/~cris/blog/index.php/archives/277

Loren Shure

Reading the code is a fun way to learn some image processing! The only thing I didn't care for was the super-huge figures that were nearly full-screen and therefore hard to resize and move out of the way. The solution is so fast that seeing the 3 figures in order really adds insight.

--Loren

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor

Maze_Solution/