Image display was added in version 4 of MATLAB, sometime around 1990. Many observant users noticed that the low-level image display object had default pixel values. In other words, if you called image with no input arguments, it would display a small image. If you were a MATLAB 4 user, you might have seen something like this:
When MATLAB 5 was released, some users noticed that the default image had changed.
image colormap(gray(32)) axis ij
A few users also noticed that the pixel values in the new default image were not integers.
h = findobj(gcf,'type','image'); cdata = get(h,'CData'); cdata(1:3,1:3)
ans = 11.2307 12.4251 10.4251 14.4251 15.7483 13.7483 12.3938 13.7483 12.7483
Is there something interesting about the fractional part?
imagesc(cdata - floor(cdata))
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 Conference on Image Processing in Atlanta, GA. Now, dear blog readers, you get to hear it, too.
I joined The MathWorks toward the end of 1993. Sometime in 1994, the company held its first employee charity auction. One of the "items" put up for bid was the right to choose the default image for MATLAB 5, which was then under development. As the new "image processing guy" in development, I felt some responsibility to bid. (At least, that's the way I tried to explain it later to my wife.) As it turned out, another MathWorks developer really wanted to win this item, so to win it I ended up paying big bucks. (It's all for charity, I kept reminding myself.)
Once I won the auction, I had to decide what image to pick. During this time, I frequently heard complaints from users that MATLAB could only handle double-precision values. (That lasted until 1997.) Because I heard so much about this issue, I decided that I would use all of the mantissa bits for the new default image. I solicited ideas from my fellow developers for what to include.
Here are the various images "hidden" in different bit slices of the default image pixel values. (To run the code yourself, download this little utility function, bitslice.)
The image stored in the 5 most-significant bits is the one you usually see. This is my oldest son.
defimage = pow2(get(0,'DefaultImageCData'),47); mag = 200; imshow(bitslice(defimage,47,51));
The next 5 bits show a dog that belonged to a MathWorks developer.
Here's another MathWorks pet.
This famous matrix is the inverse of the 3-by-3 Hilbert matrix.
This is a low-resolution version of the company's original logo.
Loren's favorite number.
3-by-3 magic square.
My youngest son.
A famous magic square hidden in Albrecht Durer's Melancolia.
I couldn't resist a kind of visual pun. This is the original MATLAB "eight-bit image." (That'll tell you something about my sense of humor.)
Loren at age 4.
Wilkinson, Givens, and Forsythe, from the 1964 Gatlinburg Conference on Numerical Algebra.
The original default image from MATLAB 4 is still in there.
Finally, a certain combination of three bit slices makes a yellow pig with the number 17 superimposed on it. I've been told this is some sort of secret joke within a certain mathematical community.
r = bitslice(defimage,0,0); g = bitslice(defimage,17,17); b = bitslice(defimage,34,34); imshow(cat(3,r,g,b));
There you have it - the complete story of the MATLAB default image.
function b = bitslice(a,lowbit,highbit) % BITSLICE(A,LOWBIT,HIGHBIT) % % Scales return values so that the maximum is 1.0. b = a / 2^(lowbit); b = fix(b); b = b / 2^(highbit - lowbit + 1); b = b - fix(b); b = b / max(b(:)); end
Published with MATLAB® R2021a
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.