Image Offset from Matched Filter

original image (m1)

top left corner of m2

cross-correlation (complex amplitude filter)

cross-correlation (binary phase only filter)

peak location on original image

image file: out2.img
image size: 512 x 512
block size: 5
threshold: 0.05
max # peaks: 20

Searching for peaks
peak	   value	hoff	voff
   1	1.000000	  62	 362
-1
   2	0.945098	 511	 350
   3	0.925490	 423	 306
   4	0.925490	 423	 322
   5	0.913725	   0	 190
   6	0.909804	   0	 274
   7	0.905882	 511	 151
   8	0.901961	 424	  88
   9	0.890196	 424	  51
  10	0.886275	   0	 151

binary phase only filter

Matlab code

>> [m1,map]=tiffread('map1.tif');
>> m1 = ind2gray(m1,map);
>> [m2,map]=tiffread('smap2.tif');
>> m2 = ind2gray[m2,map];

>> sect = m2(1:64,1:64);
>> whos

  Name       Size         Bytes  Class

  m1       583x424      1977536  double array
  m2       545x424      1848640  double array
  map      256x3           6144  double array
  sect      64x64         32768  double array

>> m1c=zeros(512,512);
>> m1c(1:512,1:424) = m1(72:583,1:424);
>> imshow(m1c);

>> fft1= fft2(fftshift(m1c));
>> sectfft = fft2(sect,512,512);
>> prod = fft1.*conj(sectfft);
>> out = abs(ifft2(prod));
>> out = out/max(out(:));
>> out = fftshift(out);
>> imshow(out);

>> bpof = imag(sectfft)>0;
>> bpof = 2*bpof-1;
>> out2 = abs(fftshift(ifft2(fft1.*bpof)));
>> out2 = out2/max(out2(:));
>> imshow(out2);
>> tiffwrite(sect,'sect.tif');
>> imshow(bpof);
>> tiffwrite((bpof+1)/2.0,'bpof.tif');
>> tiffwrite(out2,'out2.tif');
>> tiffwrite(out,'out.tif');
>> tiffwrite(m1c,'m1c.tif');


Maintained by John Loomis, last updated July 28, 1997