I'm developing correlation filters based image recognition.
I implemented MACE correlation filter in matlab:

training code:

D = diag(mean(abs(X),2));
% inv(A) * B = A \ B
XDX = ctranspose(X) * (D \ X);
h = (D \ X) * (XDX \ u);
H = reshape(h, size(I));

where X is the d.^2xN matrix of vectorized FFT2 transformed training images (images FFT2 transform spectra are vectorized by concatenating columns), u is the vector of image membership (1 for images to recognize and 0 for the rest of the samples), I is the dxd sample training image to reshape correlation filter h to H matrix.

testing code:

R = ifftshift(ifft2(I.*conj(H)));

where I is the dxd test image zero mean and unit variance normalized and H is the trained correlation filter.

I trained one correlation filter on 61 training images from which there is just 1 image to recognize with 1 in vector u and remaining images with 0's in vector u.

However despite reported results in the papers on correlation filters where correlation plane output is in range 0 ... 1 my results are up to 10e-4.

correlation plane surfaces for recognized and unrecognized images

Is there any normalization typically applied to scale correlation plane output?

Besides I found that without conj(H) in the testing code there is no correlation peak for images to be recognized. I was unable to find in the papers that missing operator in the formula which I found at mathworks forum


I was just working on the same issue and the magnitude was the same as yours (10e-4), but the peak in the middle, in terms of the shape, looked correct.

I was able to solve this problem by scaling back R, by d, the number of pixels in the image. In my case I am using 64 x 64 pixel images (d = 64*64 = 4096).

Also, make sure you take the real of R, to get rid of the complex part, even though it should be very small, then multiply R by d and your scaling should be correct. To test this, use an image you trained your filter on and your max(R(:)*d) = 1.0.

R = ifftshift(ifft2(test_img.*conj(H_square)));
R = real(R);
axis([0 64 0 64 -0.5 1]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.