Progress Report 3


This time we start with a pisces symbol.
>> [pisces,map1] = gifread('pisces.gif');
>> colormap(gray(max(max(pisces))));
>> image(pisces)

Our template will now be one of the fish.
>> fish=pisces(1:20,1:90);
>> colormap(gray(max(max(fish))));
>> image(fish)

Picture Adjustment
>> pisces=pisces-1;
>> fish=fish-1;

Straight 2-D convolution: normalization numerator.
>> TwoDConv = conv2(pisces,fish);
>> colormap(gray(max(max(TwoDConv))));
>> image(TwoDConv);

Denominator calculation.
>> piscessqr=pisces.^2;
>> flat=ones(size(fish));
>> norml = conv2(piscessqr,flat);
>> rtnorml = norml .^ 0.5;
>> colormap(gray(max(max(rtnorml))));
>> image(rtnorml);

Remove problem with division by zero.
>> rtnorml = rtnorml + .1;
>> cnvnorm = TwoDConv ./ rtnorml;
>> colormap(gray(max(max(cnvnorm))));
>> image(cnvnorm);

That's pretty hard to tell. We use thresholding to isolate our image.
>> [a,b]=size(cnvnorm); >> most=max(max(max(cnvnorm))); >> for rows=1:a for cols=1:b if (cnvnorm(rows,cols)<(most-1)) cnvnorm(rows,cols)=0; end end end >> colormap(gray(2));
>> image(cnvnorm);

Hmm..that's wierd! I guess maybe the 2D conv flips stuff around, and we just didn't see that because the movie reels and the box were all symmetric. Let me double-check by testing the second fish in the image.


We start with the same pisces symbol.
>> [pisces,map1] = gifread('pisces.gif');
>> colormap(gray(max(max(pisces))));
>> image(pisces)

Our template will now be the other fish.
>> fish2=pisces(25:43,5:90);
>> colormap(gray(max(max(fish2))));
>> image(fish2)

>> pisces=pisces-1;
>> fish2=fish2-1;

>> TwoDConv = conv2(pisces,fish2);
>> colormap(gray(max(max(TwoDConv))));
>> image(TwoDConv);


>> piscessqr=pisces.^2;
>> flat=ones(size(fish2));
>> norml = conv2(piscessqr,flat);
>> rtnorml = norml .^ 0.5;
>> colormap(gray(max(max(rtnorml))));
>> image(rtnorml);

>> rtnorml = rtnorml + .1;
>> cnvnorm = TwoDConv ./ rtnorml;
>> colormap(gray(max(max(cnvnorm))));
>> image(cnvnorm);

>> [a,b]=size(cnvnorm); >> most=max(max(max(cnvnorm))); >> for rows=1:a for cols=1:b if (cnvnorm(rows,cols)<(most-1)) cnvnorm(rows,cols)=0; end end end >> colormap(gray(2));
>> image(cnvnorm);

Okay, that proves it. Our methodology looks for the flipped image! It's good that it finds it, though!