I have two pictures. One is a small image of Waldo and the other is a much larger image with him hiding somewhere. My goal is to create a program that will find Waldo using only the functions length, size, imread, and image. This is what I have so far.
[row,column,layer] = size(Waldo);
[row_,column_,layer_] = size(wheresWaldo);
counter = 0;
for i = 1:1:row_
for j = 1:1:column_
for k = 1:1:layer_
if wheresWaldo(i,j,1) == Waldo(1,1,1) && wheresWaldo(i,j,2) == Waldo(1,1,2) && wheresWaldo(i,j,3) == Waldo(1,1,3)
counter = counter + 1;
ivals(counter) = i;
jvals(counter) = j;
What I am doing here is taking the first pixel of the Waldo image and seeing where the R G B values of that pixel occur in the wheresWaldo image. I found several instances and stores them in the variables ivals and jvals. ivals represent rows and jvals represents columns.