{"id":227,"date":"2010-04-21T12:22:59","date_gmt":"2010-04-21T12:22:59","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/2010\/04\/21\/a-mazing-way-to-learn-some-image-processing\/"},"modified":"2018-01-08T15:25:17","modified_gmt":"2018-01-08T20:25:17","slug":"a-mazing-way-to-learn-some-image-processing","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2010\/04\/21\/a-mazing-way-to-learn-some-image-processing\/","title":{"rendered":"A-Mazing Way to Learn Some Image Processing"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>I recently noticed this <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/27175-maze-solution\">new submission<\/a> on the File Exchange by none other than one of the prolific <a >newsgroup<\/a> contributors, <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/31862\">Image Analyst<\/a>.  Being a fan of puzzles myself, I was delighted to see the use of image processing to solve some mazes.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#1\">Sample Solution<\/a><\/li>\r\n         <li><a href=\"#2\">Method<\/a><\/li>\r\n         <li><a href=\"#3\">Other \"Games\" to Learn From?<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <h3>Sample Solution<a name=\"1\"><\/a><\/h3>\r\n   <p>Here's a picture of a sample maze solution.<\/p>\r\n   <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/227\/maze.png\"> <\/p>\r\n   <h3>Method<a name=\"2\"><\/a><\/h3>\r\n   <p>Instead of doing traditional actions like <i>move right until hitting a dead end<\/i>, the maze solver here uses image processing concepts such as morphological operations (e.g., dilation and erosion), thresholding,\r\n      and sectioning an image into \"blobs.\"  Reading and understanding the code provided me with a fun way to reinforce the application\r\n      of these image processing concepts.\r\n   <\/p>\r\n   <h3>Other \"Games\" to Learn From?<a name=\"3\"><\/a><\/h3>\r\n   <p>Do you know of other MATLAB-based games or puzzles where understanding the code might provide insight into some computing\r\n      domain for users?  If so, let us know <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=227#respond\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_cddffc30bfaa4e38a219a1de2d4ef135() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='cddffc30bfaa4e38a219a1de2d4ef135 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' cddffc30bfaa4e38a219a1de2d4ef135';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Loren Shure';\r\n        copyright = 'Copyright 2010 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_cddffc30bfaa4e38a219a1de2d4ef135()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.10<br><\/p>\r\n<\/div>\r\n<!--\r\ncddffc30bfaa4e38a219a1de2d4ef135 ##### SOURCE BEGIN #####\r\n%% A-Mazing Way to Learn Some Image Processing\r\n% I recently noticed this\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/27175-maze-solution\r\n% new submission> on the File Exchange by none other than one of the\r\n% prolific <http:\/\/ newsgroup> \r\n% contributors, <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/31862\r\n% Image Analyst>.  Being a fan of puzzles myself, I was delighted\r\n% to see the use of image processing to solve some mazes.\r\n%% Sample Solution\r\n% Here's a picture of a sample maze solution.\r\n%\r\n% <<maze.png>>\r\n% \r\n%% Method\r\n% Instead of doing traditional actions like _move right until hitting a\r\n% dead end_, the maze solver here uses image processing concepts such as\r\n% morphological operations (e.g., dilation and erosion), thresholding, and\r\n% sectioning an image into \"blobs.\"  Reading and understanding the code\r\n% provided me with a fun way to reinforce the application of these image\r\n% processing concepts.\r\n%% Other \"Games\" to Learn From?\r\n% Do you know of other MATLAB-based games or puzzles where understanding\r\n% the code might provide insight into some computing domain for users?  If\r\n% so, let us know <https:\/\/blogs.mathworks.com\/loren\/?p=227#respond here>.\r\n\r\n##### SOURCE END ##### cddffc30bfaa4e38a219a1de2d4ef135\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      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... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2010\/04\/21\/a-mazing-way-to-learn-some-image-processing\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/227"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":2580,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/227\/revisions\/2580"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}