Loren on the Art of MATLAB

April 21st, 2010

A-Mazing Way to Learn Some Image Processing

I recently noticed this new submission on the File Exchange by none other than one of the prolific newsgroup contributors, Image Analyst. Being a fan of puzzles myself, I was delighted to see the use of image processing to solve some mazes.

Contents

Sample Solution

Here's a picture of a sample maze solution.

Method

Instead of doing traditional actions like move right until hitting a dead end, the maze solver here uses image processing concepts such as morphological operations (e.g., dilation and erosion), thresholding, and sectioning an image into "blobs." Reading and understanding the code provided me with a fun way to reinforce the application of these image processing concepts.

Other "Games" to Learn From?

Do you know of other MATLAB-based games or puzzles where understanding the code might provide insight into some computing domain for users? If so, let us know here.


Get the MATLAB code

Published with MATLAB® 7.10

3 Responses to “A-Mazing Way to Learn Some Image Processing”

  1. Andrey replied on :

    The file is very interesting and nice!
    Indeed quite an original way to solve the maze problem, which helps to clarify the concept of erosion, dilation and other image processing functions.

    Nevertheless, I find the style of writing a single long script a bit problematic.
    I can think of at least 2 separate independent functions here:
    1) Get the image from disk.
    2) Solve the problem on a given image.
    What If I want to run the maze solver on image not from disk? I would have to dig up the code and find which part does this functionality and create my own function. Quite a painful process.

  2. Matteo replied on :

    Hello Loren

    Yes indeed, great submission.
    Look also at what Cris Luengo has published on his image processign blog.
    http://www.cb.uu.se/~cris/blog/index.php/archives/277
    Matteo

  3. Matteo replied on :

    These guy’s work is also fascinating
    http://www.cgl.uwaterloo.ca/~csk/projects/mazes/
    http://www.cgl.uwaterloo.ca/~csk/papers/xu_kaplan_siggraph2007.pdf


MathWorks
Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.