{"id":754,"date":"2013-01-28T16:13:36","date_gmt":"2013-01-28T21:13:36","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=754"},"modified":"2019-11-01T09:09:55","modified_gmt":"2019-11-01T13:09:55","slug":"george-forsythe-is-inside-the-default-matlab-image","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2013\/01\/28\/george-forsythe-is-inside-the-default-matlab-image\/","title":{"rendered":"George Forsythe is inside the default MATLAB image"},"content":{"rendered":"<div class=\"content\"><p>A couple of weeks ago, <a href=\"https:\/\/blogs.mathworks.com\/cleve\">Cleve<\/a> wrote a <a title=\"https:\/\/blogs.mathworks.com\/cleve\/2013\/01\/07\/george-forsythe\/ (link no longer works)\">post about George Forsythe<\/a>, Cleve's \"thesis advisor, colleague, and friend.\"<\/p><p>In that post, Cleve showed some MATLAB code to load in and display a 1964 picture of the organizing committee of the Gatlinburg conferences on numerical algebra.<\/p><pre class=\"codeinput\">load <span class=\"string\">gatlin<\/span>\r\nimage(X)\r\ncolormap(map)\r\naxis <span class=\"string\">image<\/span>\r\naxis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/default_image_again_01.png\" alt=\"\"> <p>As Cleve mentioned, this picture is one of the very first images distributed with MATLAB. (I recall getting the first MATLAB version capable of image display sometime around 1990. It was very exciting!)<\/p><p>As it turns out, there is another interesting method in MATLAB to display this picture (or at least a cropped, low-resolution version of it):<\/p><pre class=\"codeinput\">default_image = pow2(get(0,<span class=\"string\">'DefaultImageCData'<\/span>),47);\r\nnumbits = 12 - 9 + 1;\r\nb = bitshift(default_image,-9);\r\nb = fix(b);\r\nb = bitand(b,bitcmp(0,4));\r\nb = b\/max(b(:));\r\n\r\nimshow(b,<span class=\"string\">'InitialMagnification'<\/span>,200)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/default_image_again_02.png\" alt=\"\"> <p>Forsythe is on the right of the cropped version.<\/p><p>So, what's going on here? Well, it turns out that, if you call <tt>image<\/tt> with no input arguments (no data), an image with \"default\" pixel values gets displayed. Furthermore, that image has many images \"hidden\" within it. For the full story, see <a href=\"https:\/\/blogs.mathworks.com\/steve\/2006\/10\/17\/the-story-behind-the-matlab-default-image\/\">\"The Story Behind the Default MATLAB Image.\"<\/a><\/p><p>Cleve knew that I was working on this little hidden-image project in the mid-1990s, and I asked him for suggestions about images to include. He suggested this Gatlinburg Conference picture, as well as the 4-by-4 Durer magic square.<\/p><pre class=\"codeinput\">c = bitshift(default_image,-23);\r\nc = fix(c);\r\nc = bitand(c,bitcmp(0,5));\r\nc = c\/max(c(:));\r\n\r\nimshow(c,<span class=\"string\">'InitialMagnification'<\/span>,200)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/default_image_again_03.png\" alt=\"\"> <p>Thanks for the suggestions, Cleve!<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_2ff8e05cb7504dd9a3fd9f8ebee00ebb() {\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='2ff8e05cb7504dd9a3fd9f8ebee00ebb ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 2ff8e05cb7504dd9a3fd9f8ebee00ebb';\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        copyright = 'Copyright 2013 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 copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\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     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_2ff8e05cb7504dd9a3fd9f8ebee00ebb()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2012b<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2012b<br><\/p><\/div><!--\r\n2ff8e05cb7504dd9a3fd9f8ebee00ebb ##### SOURCE BEGIN #####\r\n%%\r\n% A couple of weeks ago, <https:\/\/blogs.mathworks.com\/cleve Cleve> wrote a\r\n% <https:\/\/blogs.mathworks.com\/cleve\/2013\/01\/07\/george-forsythe\/ post about\r\n% George Forsythe>, Cleve's \"thesis advisor, colleague, and friend.\"\r\n%\r\n% In that post, Cleve showed some MATLAB code to load in and display a\r\n% 1964 picture of the organizing committee of the Gatlinburg conferences on\r\n% numerical algebra.\r\n\r\nload gatlin\r\nimage(X)\r\ncolormap(map)\r\naxis image\r\naxis off\r\n\r\n%%\r\n% As Cleve mentioned, this picture is one of the very first images\r\n% distributed with MATLAB. (I recall getting the first MATLAB version\r\n% capable of image display sometime around 1990. It was very exciting!)\r\n%\r\n% As it turns out, there is another interesting method in MATLAB to display\r\n% this picture (or at least a cropped, low-resolution version of it):\r\n\r\ndefault_image = pow2(get(0,'DefaultImageCData'),47);\r\nnumbits = 12 - 9 + 1;\r\nb = bitshift(default_image,-9);\r\nb = fix(b);\r\nb = bitand(b,bitcmp(0,4));\r\nb = b\/max(b(:));\r\n\r\nimshow(b,'InitialMagnification',200)\r\n\r\n%%\r\n% Forsythe is on the right of the cropped version.\r\n%\r\n% So, what's going on here? Well, it turns out that, if you call |image|\r\n% with no input arguments (no data), an image with \"default\" pixel values\r\n% gets displayed. Furthermore, that image has many images \"hidden\" within it.\r\n% For the full story, see\r\n% <https:\/\/blogs.mathworks.com\/steve\/2006\/10\/17\/the-story-behind-the-matlab-default-image\/\r\n% \"The Story Behind the Default MATLAB Image.\">\r\n%\r\n% Cleve knew that I was working on this little hidden-image project in the\r\n% mid-1990s, and I asked him for suggestions about images to include. He\r\n% suggested this Gatlinburg Conference picture, as well as the 4-by-4 Durer\r\n% magic square.\r\n\r\nc = bitshift(default_image,-23);\r\nc = fix(c);\r\nc = bitand(c,bitcmp(0,5));\r\nc = c\/max(c(:));\r\n\r\nimshow(c,'InitialMagnification',200)\r\n\r\n%%\r\n% Thanks for the suggestions, Cleve!\r\n##### SOURCE END ##### 2ff8e05cb7504dd9a3fd9f8ebee00ebb\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/default_image_again_03.png\" onError=\"this.style.display ='none';\" \/><\/div><p>A couple of weeks ago, Cleve wrote a post about George Forsythe, Cleve's \"thesis advisor, colleague, and friend.\"In that post, Cleve showed some MATLAB code to load in and display a 1964 picture of... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/01\/28\/george-forsythe-is-inside-the-default-matlab-image\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[50,975,977,258,58,973,48,36,362,122,254],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/754"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/comments?post=754"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/754\/revisions"}],"predecessor-version":[{"id":3811,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/754\/revisions\/3811"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}