# corr

## PURPOSE

corr - Compute inhibition map among filters

## SYNOPSIS

function C = corr(F, epsilon)

## DESCRIPTION

     corr - Compute inhibition map among filters

     F: the bank of filters
     epsilon: threshold for correlation
     C: the inhibition matrix

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- ABlearn ABlearn - Learns an active basis template from images.

## SOURCE CODE

    0001 function C = corr(F, epsilon)
    0002 % corr - Compute inhibition map among filters
    0003 %
    0004 % F: the bank of filters
    0005 % epsilon: threshold for correlation
    0006 % C: the inhibition matrix
    0007
    0008 N = size(F, 2);   % N: the number of filters
    0009
    0010 for (i = 1:N)
    0011    hi = (size(F{i}, 1)-1)/2;   % half size of filter i
    0012    for (j = 1:N)
    0013       hj = (size(F{j}, 1)-1)/2;    % half size of filter j
    0014       I = zeros(2*(hi+hj)+1)+sqrt(-1)*zeros(2*(hi+hj)+1);
    0015       I((hj+1):(hj+2*hi+1), (hj+1):(hj+2*hi+1)) = F{i}; % put F{i} at the center
    0016
    0017       % convolve F{i} by F{j}, 4 real-imaginary combinations
    0018       rr = filter2(real(F{j}), real(I), 'same');
    0019       ri = filter2(real(F{j}), imag(I), 'same');
    0020       ir = filter2(imag(F{j}), real(I), 'same');
    0021       ii = filter2(imag(F{j}), imag(I), 'same');
    0022       C{i, j} = ((rr.*rr + ri.*ri + ir.*ir + ii.*ii)<epsilon)*1.0;
    0023       % C{i,j} is how filter i at (0,0) inhibites filter j at
    0024       % locations overlapping with filter i
    0025    end
    0026 end
    0027