From: ImageAnalyst on
If anyone wants a fun diversion, I just uploaded an m-file to the File
Exchange to solve a maze using MATLAB (with the Image Processing
Toolbox and mathematical morphology). Here is the link:

http://www.mathworks.com/matlabcentral/fileexchange/27175-mazesolution

Description: 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.

Required Products Image Processing Toolbox

MATLAB release MATLAB 7.10 (2010a)
Zip File Content
Other Files license.txt,
Maze_Solution/maze_solution.m,
Maze_Solution/Screenshot.png
Maze_Solution/SampleMazes/bias.gif,
Maze_Solution/SampleMazes/BigMaze.png,
Maze_Solution/SampleMazes/cruiser1.gif,
Maze_Solution/SampleMazes/Maze1.gif,
Maze_Solution/SampleMazes/run.gif,