Zero mean normalized cross correlation



Hi:

I'm doing some template matching. Here are the formulae for the
different comparison methods I use (I denotes image, T - template, R -
result. The summation is done over template and/or the image patch:
x'=0..w-1, y'=0..h-1):


method=Cross_correlation:
R(x,y)=sumx',y'[T(x',y')·I(x+x',y+y')]

method=Normalized_cross_correlation:
R(x,y)=sumx',y'[T(x',y')·I(x+x',y+y')]/sqrt[sumx',y'T(x',y')2·sumx',y'I(x+x',y+y')2]

method=Cross_correlation_coefficient:
R(x,y)=sumx',y'[T'(x',y')·I'(x+x',y+y')],

where T'(x',y')=T(x',y') - 1/(w·h)·sumx",y"T(x",y")
I'(x+x',y+y')=I(x+x',y+y') - 1/(w·h)·sumx",y"I(x+x",y+y")

method=Normalized_cross_correlation_coefficient:
R(x,y)=sumx',y'[T'(x',y')·I'(x+x',y+y')]/sqrt[sumx',y'T'(x',y')2·sumx',y'I'(x+x',y+y')2]

My question is:

1- What's the difference between these and zero mean normalized cross
correlation? Can you give me any formula of the ZMNCC?

2- Is there some code to do ZMNCC?

Regards,

Sergio

.