File Exchange Pick of the Week

July 3rd, 2008

Puzzler: Data exploration solution

This was a fun little puzzle. I wonder how many people got to the first image, but did not continue to the real solution!

Contents

Load the data and take a first look

load puzzler.mat
plot(c,'.')

What is this stuff?

There is a lot of data, ranges from ~0 to ~255. Makes me think it is an image that has been made into a vector. How many different ways can this data be reshaped into a matrix?

dimensions = factor(numel(c))
dimensions =
   419   557

Reshape it!

What 'luck'! There is only one pair of prime factors. Makes you think this is the right path.

d = reshape(c, dimensions);
imagesc(d)
colormap(gray)

Tricky one.

We are on the right path, but not there yet. Those values were suspicious. Why were there decimal parts for an image. Let's look at the decimal parts.

e = rem(d,1);
imagesc(e)

There is pattern here

This is the right path, there is pattern here

f = e(:);
plot(f,'.');

Lets try the other reshape

There are two possible reshapes, try the other

g = reshape(f, fliplr(dimensions));
imagesc(g)

This is it

Now just clean it up a little

h = rot90(g, -1);
imagesc(h)


Get the MATLAB code

Published with MATLAB® 7.6

6 Responses to “Puzzler: Data exploration solution”

  1. farmboy replied on :

    That was it? I was trying to find RGB values and could not find the blue value….

    Wow, I guess I was looking to hard.

    Corey

  2. DanK replied on :

    I was also looking for RGB after I found the first image. The other thing I noticed was that if you looked at 1/e it tended to be distributed in the 1 to 256 range (with just a couple of exceptions, which made me think the fractional portions were supposed to be inverted. Oh well. Overthought that one.

    Dan

  3. christian replied on :

    ok, you win! i find the image, but never thought the show in this post. Good game and post. thanks

  4. Harsha replied on :

    As farmboy and DanK even I was trying to find RGB values after the first image…..good one though. I would appreciate Doug, if he could explain how he made this vector.

  5. Rajanikanth Jammalamadaka replied on :

    Even I could get only to the first image…Nice Puzzle.

  6. Doug replied on :

    Seems to be a lot of interest in how I generated this puzzle. It was just kind of throw away code. Here was the basic procedure:

    Get the original image from logo.m, edit in pain to add the messages.

    Import into MATLAB and chop to convenient prime width and heights. Save images to disk.

    Read in first image, make into a column.
    Read in second image, rot90, make into a column, add a sin wave so everyone knows it is not an accident. Divide by 1000 to make it a decimal. Add to the original.

    Test the solution to make sure I did this all right. This is pretty much all there was.

    This idea is from steganography:

    http://en.wikipedia.org/wiki/Steganography

    The Easter Egg in IMAGE uses this too:
    http://blogs.mathworks.com/steve/2006/10/17/the-story-behind-the-matlab-default-image/

    Glad you all enjoyed, I will have to make some more puzzles.

    Doug

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

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