1
$\begingroup$

I have a C++ code that computes cross-correlation for a given 2 vectors as input. It doesn't have an implicit normalization or normalized implementation of cross-correlation. But I would prefer a noramlized output. I referred the Wikipedia article on cross-correlation and it states the following formula to get a normalized cross-correlation:

                                                               Normalized Cross-Correlation

I was wondering:

  1. since $\sigma_f$ and $\sigma_t$ and are going to be a constant scalar for any given vectors, can I just multiply $$ \frac{1}{n * \sigma_f * \sigma_t} $$

    to the cross-correlation vector and obtain a normalized cross-correlation vector? Please correct me if I'm wrong here and suggest a way to do it if it's possible.

  2. what can be done if both input vectors are not of the same size? Is zero-padding the shorter vector the only option? Or can the above factor be modified to accomodate both the lengths?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.