If you haven't had the pleasure (frustration?) of solving "Where's Waldo?" puzzles, stop by Ellen's office and have a look at some. The color images below show the real Waldo and a carnival scene. In this problem, you'll write a program to solve a variation of the "Where's Waldo?" task. In this problem, Waldo is a tiny 3x3 image with the following pattern of black and white that looks vaguely like a face:
|
Waldo is hidden somewhere in this image of randomly arranged black and white dots:
You probably don't want to solve this one yourself, which is why you're going to write a MATLAB program to find Waldo. There's only one copy of Waldo's face in the above picture, and the goal of your program is to print out the row and column of the center location of his face. You are going to work only with the black and white images above, the color ones are simply for illustration purposes.
The file setupWaldo.m
in the assign3_programs
folder loads in
the above image and converts it to a 64x64 matrix of the values 0.0 and 1.0 that is assigned
to the variable wheresWaldo
. This file also creates the 3x3 waldo
image. When you start your work on this problem, call setupWindow
in the
Command Window to set up the wheresWaldo
and waldo
images. You can
view these images with the imshow
function (remember that waldo
is
tiny!)
Create a new file named findWaldo.m
to place your code to find Waldo.
Your code should create a 64x64 matrix of logical values that has a single 1 at the center
location of the waldo
pattern that is embedded in the wheresWaldo
image. Suppose your matrix of logical values is named waldoPlace
. The
find
function can then be used to assign the coordinates of this 1 that is
stored in waldoPlace
:
[row col] = find(waldoPlace)
There is one constraint on your implementation that you must abide by:
You can only use aspects of MATLAB that you learned in class (lecture or lab) through
Lab #4 on February 21 or 22, and through the completion of the Lecture #7 material on
February 20th! You cannot use any additional MATLAB that you learned
about through other sources. In particular, you cannot use loops (for example, you cannot
use for
or while
statements). This constraint makes this
a challenging problem. We will provide only one general hint: it is ok to
create additional matrices from the contents of the waldo
or wheresWaldo
images to help with your solution. This problem is worth 10 points of extra
credit on this assignment, and solutions will be accepted until lecture time on
Tuesday, March 6. If you cannot complete the program
successfully, you can still submit a partial solution for partial credit.
If you choose to solve this problem, be sure to add comments to your code, including a summary of your solution strategy,
before submitting your final findWaldo.m
code file.