{"id":88,"date":"2006-10-18T19:53:06","date_gmt":"2006-10-19T00:53:06","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?page_id=88"},"modified":"2006-10-19T14:54:11","modified_gmt":"2006-10-19T19:54:11","slug":"test","status":"publish","type":"page","link":"https:\/\/blogs.mathworks.com\/steve\/test\/","title":{"rendered":"Test"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>Image display was added in version 4 of MATLAB, sometime around 1990. Many observant users noticed that the low-level image\r\n         display object had default pixel values.  In other words, if you called <tt>image<\/tt> with no input arguments, it would display a small image.  If you were a MATLAB 4 user, you might have seen something like\r\n         this:\r\n      <\/p>\r\n      <p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/dp.png\"> <\/p>\r\n   <\/introduction>\r\n   <p>When MATLAB 5 was released, some users noticed that the default image had changed.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">image\r\ncolormap(gray(32))\r\naxis <span style=\"color: #A020F0\">ij<\/span><\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_01.jpg\"> <p>A few users also noticed that the pixel values in the new default image were not integers.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">h = findobj(gcf,<span style=\"color: #A020F0\">'type'<\/span>,<span style=\"color: #A020F0\">'image'<\/span>);\r\ncdata = get(h,<span style=\"color: #A020F0\">'CData'<\/span>);\r\ncdata(1:3,1:3)<\/pre><pre style=\"font-style:oblique\">\r\nans =\r\n\r\n   11.2307   12.4251   10.4251\r\n   14.4251   15.7483   13.7483\r\n   12.3938   13.7483   12.7483\r\n\r\n<\/pre><p>Is there something interesting about the fractional part?<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imagesc(cdata - floor(cdata))<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_02.jpg\"> <p>Apparently so.<\/p>\r\n   <p>I now confess - you can blame me for all of this.  I told this story in public for the first time last week at the IEEE International\r\n      Conference on Image Processing in Atlanta, GA.  Now, dear blog readers, you get to hear it, too.\r\n   <\/p>\r\n   <p>I joined The MathWorks toward the end of 1993.  Sometime in 1994, the company held its first employee charity auction.  One\r\n      of the \"items\" put up for bid was the right to choose the default image for MATLAB 5, which was then under development.  As\r\n      the new \"image processing guy\" in development, I felt some responsibility to bid.  (At least, that's the way I tried to explain\r\n      it later to my wife.)  As it turned out, another MathWorks developer really wanted to win this item, so to win it I ended\r\n      up paying big bucks.  (It's all for charity, I kept reminding myself.)\r\n   <\/p>\r\n   <p>Once I won the auction, I had to decide what image to pick.  During this time, I frequently heard complaints from users that\r\n      MATLAB could only handle double-precision values.  (That lasted until 1997.)  Because I heard so much about this issue, I\r\n      decided that I would use all of the mantissa bits for the new default image.  I solicited ideas from my fellow developers\r\n      for what to include.\r\n   <\/p>\r\n   <p>Here are the various images \"hidden\" in different bit slices of the default image pixel values.  (To run the code yourself,\r\n      download this little utility function, <a href=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/bitslice.m\">bitslice<\/a>.)\r\n   <\/p>\r\n   <p>The image stored in the 5 most-significant bits is the one you usually see.  This is my oldest son.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">defimage = pow2(get(0,<span style=\"color: #A020F0\">'DefaultImageCData'<\/span>),47);\r\nmag = 200;\r\nimshow(bitslice(defimage,47,51), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_03.jpg\"> <p>The next 5 bits show a dog that belonged to a MathWorks developer.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,42,46), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_04.jpg\"> <p>Here's another MathWorks pet.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,37,41), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_05.jpg\"> <p>This famous matrix is the inverse of the 3-by-3 Hilbert matrix.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,36,36), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_06.jpg\"> <p>This is a low-resolution version of the company's original logo.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,35,35), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_07.jpg\"> <p>Loren's favorite number.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,34,34), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_08.jpg\"> <p>3-by-3 magic square.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,33,33), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_09.jpg\"> <p>My youngest son.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,28,32), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_10.jpg\"> <p>A famous magic square hidden in Albrecht Durer's Melancolia.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,23,27), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_11.jpg\"> <p>I couldn't resist a kind of visual pun.  This is the original MATLAB \"eight-bit image.\"  (That'll tell you something about\r\n      my sense of humor.)\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,18,22), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_12.jpg\"> <p>Loren at age 4.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,13,16), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_13.jpg\"> <p>Wilkinson, Givens, and Forsythe, from the 1964 Gatlinburg Conference on Numerical Algebra.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,9,12), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_14.jpg\"> <p>Me.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,5,8), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_15.jpg\"> <p>The original default image from MATLAB 4 is still in there.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">imshow(bitslice(defimage,1,4), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_16.jpg\"> <p>Finally, a certain combination of three bit slices makes a yellow pig with the number 17 superimposed on it.  I've been told\r\n      this is some sort of secret joke within a certain mathematical community.\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">r = bitslice(defimage,0,0);\r\ng = bitslice(defimage,17,17);\r\nb = bitslice(defimage,34,34);\r\nimshow(cat(3,r,g,b), <span style=\"color: #A020F0\">'initialmag'<\/span>, mag);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/87\/default_image_story_17.jpg\"> <p>There you have it - the complete story of the MATLAB default image.<\/p><script language=\"JavaScript\"> \r\n    function grabCode(id) {\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='##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####';\r\n \r\n        if (id.length > 0) {\r\n            \/\/ Look for the specified identifier before and after\r\n            \/\/ the source code markers.\r\n            t1 = id + ' ' + t1;\r\n            t2 = t2 + ' ' + id;\r\n        }\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        \/\/ Clear the body.  In some cases it seems to be necessary so\r\n        \/\/ that the code doesn't just get appended to the existing\r\n        \/\/ body.\r\n        b.innerHTML = '';\r\n\r\n        author = 'Steve Eddins';\r\n        copyright = 'Copyright 2006 The MathWorks, Inc.';\r\n\r\n        document.write('<pre>\\n');\r\n        document.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            document.writeln('');\r\n            document.writeln('%%');\r\n            if (author.length > 0) {\r\n                document.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                document.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        document.write('<\/pre>\\n');\r\n      \r\n      document.title = title + ' (MATLAB code)';\r\n      document.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('33c27290-0b7c-415a-bfac-541258c973f3')\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code<\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.3<br><\/p>\r\n<\/div>\r\n<!--\r\n33c27290-0b7c-415a-bfac-541258c973f3 ##### SOURCE BEGIN #####\r\n%% The Story Behind the MATLAB Default Image\r\n% Image display was added in version 4 of MATLAB, sometime around 1990.  \r\n% Many observant users noticed that the low-level image display object had\r\n% default pixel values.  In other words, if you called |image| with no\r\n% input arguments, it would display a small image.  If you were a MATLAB 4\r\n% user, you might have seen something like this:\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/images\/steve\/87\/dp.png>>\r\n\r\n%%\r\n% When MATLAB 5 was released, some users noticed that the default image had\r\n% changed.\r\n\r\nimage\r\ncolormap(gray(32))\r\naxis ij\r\n\r\n%%\r\n% A few users also noticed that the\r\n% pixel values in the new default image were not integers.\r\n\r\nh = findobj(gcf,'type','image');\r\ncdata = get(h,'CData');\r\ncdata(1:3,1:3)\r\n\r\n%%\r\n% Is there something interesting about the fractional part?\r\n\r\nimagesc(cdata - floor(cdata))\r\n\r\n%%\r\n% Apparently so.\r\n%\r\n% I now confess - you can blame me for all of this.  I told this story in\r\n% public for the first time last week at the IEEE International Conference\r\n% on Image Processing in Atlanta, GA.  Now, dear blog readers, you get to\r\n% hear it, too.\r\n%\r\n% I joined The MathWorks toward the end of 1993.  Sometime in 1994, the\r\n% company held its first employee charity auction.  One of the \"items\"\r\n% put up for bid was the right to choose the default image for MATLAB 5,\r\n% which was then under development.  As the new \"image processing guy\" in\r\n% development, I felt some responsibility to bid.  (At least, that's the\r\n% way I tried to explain it later to my wife.)  As it turned out, another\r\n% MathWorks developer really wanted to win this item, so to win it I ended\r\n% up paying big bucks.  (It's all for charity, I kept reminding myself.)\r\n%\r\n% Once I won the auction, I had to decide what image to pick.  During this\r\n% time, I frequently heard complaints from users that MATLAB could only\r\n% handle double-precision values.  (That lasted until 1997.)  Because I \r\n% heard so much about this issue, I decided that I would use all of the\r\n% mantissa bits for the new default image.  I solicited ideas from my\r\n% fellow developers for what to include.\r\n%\r\n% Here are the various images \"hidden\" in different bit slices of the\r\n% default image pixel values.  (To run the code yourself, download this\r\n% little utility function, <https:\/\/blogs.mathworks.com\/images\/steve\/87\/bitslice.m \r\n% bitslice>.)\r\n\r\n%%\r\n% The image stored in the 5 most-significant bits is the one you usually\r\n% see.  This is my oldest son.\r\n\r\ndefimage = pow2(get(0,'DefaultImageCData'),47);\r\nmag = 200;\r\nimshow(bitslice(defimage,47,51), 'initialmag', mag);\r\n\r\n%%\r\n% The next 5 bits show a dog that belonged to a MathWorks developer.\r\n\r\nimshow(bitslice(defimage,42,46), 'initialmag', mag);\r\n\r\n%%\r\n%\r\n% Here's another MathWorks pet.\r\nimshow(bitslice(defimage,37,41), 'initialmag', mag);\r\n\r\n%%\r\n% This famous matrix is the inverse of the 3-by-3 Hilbert matrix.\r\nimshow(bitslice(defimage,36,36), 'initialmag', mag);\r\n\r\n%%\r\n% This is a low-resolution version of the company's original logo.\r\nimshow(bitslice(defimage,35,35), 'initialmag', mag);\r\n\r\n%%\r\n% Loren's favorite number.\r\nimshow(bitslice(defimage,34,34), 'initialmag', mag);\r\n\r\n%%\r\n% 3-by-3 magic square.\r\nimshow(bitslice(defimage,33,33), 'initialmag', mag);\r\n\r\n%%\r\n% My youngest son.\r\nimshow(bitslice(defimage,28,32), 'initialmag', mag);\r\n\r\n%%\r\n% A famous magic square hidden in Albrecht Durer's Melancolia.\r\nimshow(bitslice(defimage,23,27), 'initialmag', mag);\r\n\r\n%%\r\n% I couldn't resist a kind of visual pun.  This is the original MATLAB \r\n% \"eight-bit image.\"  (That'll tell you something about my sense of humor.)\r\nimshow(bitslice(defimage,18,22), 'initialmag', mag);\r\n\r\n%%\r\n% Loren at age 4.\r\nimshow(bitslice(defimage,13,16), 'initialmag', mag);\r\n\r\n%%\r\n% Wilkinson, Givens, and Forsythe, from the 1964 Gatlinburg Conference on \r\n% Numerical Algebra.\r\nimshow(bitslice(defimage,9,12), 'initialmag', mag);\r\n\r\n%%\r\n% Me.\r\nimshow(bitslice(defimage,5,8), 'initialmag', mag);\r\n\r\n%%\r\n% The original default image from MATLAB 4 is still in there.\r\nimshow(bitslice(defimage,1,4), 'initialmag', mag);\r\n\r\n%%\r\n% Finally, a certain combination of three bit slices makes a yellow pig\r\n% with the number 17 superimposed on it.  I've been told this is some sort \r\n% of secret joke within a certain mathematical community. \r\nr = bitslice(defimage,0,0);\r\ng = bitslice(defimage,17,17);\r\nb = bitslice(defimage,34,34);\r\nimshow(cat(3,r,g,b), 'initialmag', mag);\r\n\r\n%%\r\n% There you have it - the complete story of the MATLAB default image.\r\n\r\n##### SOURCE END ##### 33c27290-0b7c-415a-bfac-541258c973f3\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      Image display was added in version 4 of MATLAB, sometime around 1990. Many observant users noticed that the low-level image\r\n         display object had default pixel values.  In other... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/test\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/pages\/88"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/page"}],"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=88"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/pages\/88\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}