
In
signal processing
Signal processing is an electrical engineering subfield that focuses on analyzing, modifying and synthesizing '' signals'', such as sound, images, and scientific measurements. Signal processing techniques are used to optimize transmissions, ...
, cross-correlation is a
measure of similarity of two series as a function of the displacement of one relative to the other. This is also known as a ''sliding
dot product
In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a scalar as a result". It is also used sometimes for other symmetric bilinear forms, for example in a pseudo-Euclidean space. is an alg ...
'' or ''sliding inner-product''. It is commonly used for searching a long signal for a shorter, known feature. It has applications in
pattern recognition
Pattern recognition is the automated recognition of patterns and regularities in data. It has applications in statistical data analysis, signal processing, image analysis, information retrieval, bioinformatics, data compression, computer graphic ...
,
single particle analysis,
electron tomography,
averaging,
cryptanalysis, and
neurophysiology
Neurophysiology is a branch of physiology and neuroscience that studies nervous system function rather than nervous system architecture. This area aids in the diagnosis and monitoring of neurological diseases. Historically, it has been dominated b ...
. The cross-correlation is similar in nature to the
convolution
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution' ...
of two functions. In an
autocorrelation
Autocorrelation, sometimes known as serial correlation in the discrete time case, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations of a random variable ...
, which is the cross-correlation of a signal with itself, there will always be a peak at a lag of zero, and its size will be the signal energy.
In
probability
Probability is the branch of mathematics concerning numerical descriptions of how likely an Event (probability theory), event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and ...
and
statistics, the term ''cross-correlations'' refers to the
correlations between the entries of two
random vectors and
, while the ''correlations'' of a random vector
are the correlations between the entries of
itself, those forming the
correlation matrix of
. If each of
and
is a scalar random variable which is realized repeatedly in a
time series
In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. E ...
, then the correlations of the various temporal instances of
are known as ''autocorrelations'' of
, and the cross-correlations of
with
across time are temporal cross-correlations. In probability and statistics, the definition of correlation always includes a standardising factor in such a way that correlations have values between −1 and +1.
If
and
are two
independent
Independent or Independents may refer to:
Arts, entertainment, and media Artist groups
* Independents (artist group), a group of modernist painters based in the New Hope, Pennsylvania, area of the United States during the early 1930s
* Independe ...
random variable
A random variable (also called random quantity, aleatory variable, or stochastic variable) is a mathematical formalization of a quantity or object which depends on random events. It is a mapping or a function from possible outcomes (e.g., the p ...
s with
probability density function
In probability theory, a probability density function (PDF), or density of a continuous random variable, is a function whose value at any given sample (or point) in the sample space (the set of possible values taken by the random variable) c ...
s
and
, respectively, then the probability density of the difference
is formally given by the cross-correlation (in the signal-processing sense)
; however, this terminology is not used in probability and statistics. In contrast, the
convolution
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution' ...
(equivalent to the cross-correlation of
and
) gives the probability density function of the sum
.
Cross-correlation of deterministic signals
For continuous functions
and
, the cross-correlation is defined as:
which is equivalent to
where
denotes the
complex conjugate
In mathematics, the complex conjugate of a complex number is the number with an equal real part and an imaginary part equal in magnitude but opposite in sign. That is, (if a and b are real, then) the complex conjugate of a + bi is equal to a - ...
of
, and
is called ''displacement'' or ''lag.'' For highly-correlated
and
which have a maximum cross-correlation at a particular
, a feature in
at
also occurs later in
at
, hence
could be described to ''lag''
by
.
If
and
are both continuous periodic functions of period
, the integration from
to
is replaced by integration over any interval
m+n)_
M, or m, is the thirteenth letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''em'' (pronounced ), plural ''ems''.
History
Th ...
/math>which is equivalent to:
(f \star g) \triangleq \sum_^ \overline g /math>For finite discrete functions f\in\mathbb^N, g\in\mathbb^M, the kernel cross-correlation is defined as:(f \star g) \triangleq \sum_^ \overline K_gm+n)_
M, or m, is the thirteenth letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''em'' (pronounced ), plural ''ems''.
History
Th ...
/math>where
K_g = (g, T_0(g)), k(g, T_1(g)), \dots, k(g, T_(g))/math> is a vector of kernel functions k(\cdot, \cdot)\colon \mathbb^M \times \mathbb^M \to \mathbb and T_i(\cdot)\colon \mathbb^M \to \mathbb^M is an affine transform
In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles.
More generally, ...
.
Specifically,
T_i(\cdot) can be circular translation transform, rotation transform, or scale transform, etc. The kernel cross-correlation extends cross-correlation from linear space to kernel space. Cross-correlation is equivariant to translation; kernel cross-correlation is equivariant to any affine transforms, including translation, rotation, and scale, etc.
Explanation
As an example, consider two real valued functions
f and
g differing only by an unknown shift along the x-axis. One can use the cross-correlation to find how much
g must be shifted along the x-axis to make it identical to
f. The formula essentially slides the
g function along the x-axis, calculating the integral of their product at each position. When the functions match, the value of
(f\star g) is maximized. This is because when peaks (positive areas) are aligned, they make a large contribution to the integral. Similarly, when troughs (negative areas) align, they also make a positive contribution to the integral because the product of two negative numbers is positive.

With
complex-valued functions
f and
g, taking the
conjugate of
f ensures that aligned peaks (or aligned troughs) with imaginary components will contribute positively to the integral.
In
econometrics
Econometrics is the application of statistical methods to economic data in order to give empirical content to economic relationships.M. Hashem Pesaran (1987). "Econometrics," '' The New Palgrave: A Dictionary of Economics'', v. 2, p. 8 p. 8� ...
, lagged cross-correlation is sometimes referred to as cross-autocorrelation.
Properties
Cross-correlation of random vectors
Definition
For
random vectors
\mathbf = (X_1,\ldots,X_m) and
\mathbf = (Y_1,\ldots,Y_n), each containing
random elements whose
expected value
In probability theory, the expected value (also called expectation, expectancy, mathematical expectation, mean, average, or first moment) is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of a ...
and
variance
In probability theory and statistics, variance is the expectation of the squared deviation of a random variable from its population mean or sample mean. Variance is a measure of dispersion, meaning it is a measure of how far a set of number ...
exist, the cross-correlation matrix of
\mathbf and
\mathbf is defined by
\operatorname_ \triangleq\ \operatorname\left mathbf \mathbf\right/math>and has dimensions m \times n. Written component-wise:\operatorname_ =
\begin
\operatorname_1 Y_1
1 (one, unit, unity) is a number representing a single or the only entity. 1 is also a numerical digit and represents a single unit of counting or measurement. For example, a line segment of ''unit length'' is a line segment of length 1. I ...
& \operatorname
_1 Y_2
1 (one, unit, unity) is a number representing a single or the only entity. 1 is also a numerical digit and represents a single unit of counting or measurement. For example, a line segment of ''unit length'' is a line segment of length ...
& \cdots & \operatorname
_1 Y_n
1 (one, unit, unity) is a number representing a single or the only entity. 1 is also a numerical digit and represents a single unit of counting or measurement. For example, a line segment of ''unit length'' is a line segment of length 1. ...
\\ \\
\operatorname
_2 Y_1& \operatorname
_2 Y_2& \cdots & \operatorname
_2 Y_n\\ \\
\vdots & \vdots & \ddots & \vdots \\ \\
\operatorname
_m Y_1& \operatorname
_m Y_2
M, or m, is the thirteenth letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''em'' (pronounced ), plural ''ems''.
History
Th ...
& \cdots & \operatorname
_m Y_n
M, or m, is the thirteenth letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''em'' (pronounced ), plural ''ems''.
History
Th ...
\end
The random vectors
\mathbf and
\mathbf need not have the same dimension, and either might be a scalar value.
Example
For example, if
\mathbf = \left( X_1,X_2,X_3 \right) and
\mathbf = \left( Y_1,Y_2 \right) are random vectors, then
\operatorname_ is a
3 \times 2 matrix whose
(i,j)-th entry is
\operatorname _i Y_j/math>.
Definition for complex random vectors
If
\mathbf = (Z_1,\ldots,Z_m) and
\mathbf = (W_1,\ldots,W_n) are
complex random vectors, each containing random variables whose expected value and variance exist, the cross-correlation matrix of
\mathbf and
\mathbf is defined by
\operatorname_ \triangleq\ \operatorname mathbf \mathbf^/math>where ^ denotes Hermitian transposition.
Cross-correlation of stochastic processes
In
time series analysis
In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. ...
and
statistics, the cross-correlation of a pair of
random process is the correlation between values of the processes at different times, as a function of the two times. Let
(X_t, Y_t) be a pair of random processes, and
t be any point in time (
t may be an
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
for a
discrete-time process or a
real number
In mathematics, a real number is a number that can be used to measurement, measure a ''continuous'' one-dimensional quantity such as a distance, time, duration or temperature. Here, ''continuous'' means that values can have arbitrarily small var ...
for a
continuous-time process). Then
X_t is the value (or
realization) produced by a given run of the process at time
t.
Cross-correlation function
Suppose that the process has means
\mu_X(t) and
\mu_Y(t) and variances
\sigma_X^2(t) and
\sigma_Y^2(t) at time
t, for each
t. Then the definition of the cross-correlation between times
t_1 and
t_2 is
[\operatorname_(t_1, t_2) \triangleq\ \operatorname\left _ \overline\right/math>where \operatorname is the ]expected value
In probability theory, the expected value (also called expectation, expectancy, mathematical expectation, mean, average, or first moment) is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of a ...
operator. Note that this expression may be not defined.
Cross-covariance function
Subtracting the mean before multiplication yields the cross-covariance between times t_1 and t_2:[\operatorname_(t_1, t_2) \triangleq\ \operatorname\left left(X_ - \mu_X(t_1)\right)\overline\right/math>Note that this expression is not well-defined for all time series or processes, because the mean or variance may not exist.
]
Definition for wide-sense stationary stochastic process
Let (X_t, Y_t) represent a pair of stochastic processes that are jointly wide-sense stationary. Then the cross-covariance function and the cross-correlation function are given as follows.
Cross-correlation function
\operatorname_(\tau) \triangleq\ \operatorname\left _t \overline\right/math> or equivalently \operatorname_(\tau) = \operatorname\left _ \overline\right/math>
Cross-covariance function
\operatorname_(\tau) \triangleq\ \operatorname\left left(X_t - \mu_X\right)\overline\right/math> or equivalently \operatorname_(\tau) = \operatorname\left left(X_ - \mu_X\right)\overline\right/math>where \mu_X and \sigma_X are the mean and standard deviation of the process (X_t), which are constant over time due to stationarity; and similarly for (Y_t), respectively. \operatorname /math> indicates the expected value
In probability theory, the expected value (also called expectation, expectancy, mathematical expectation, mean, average, or first moment) is a generalization of the weighted average. Informally, the expected value is the arithmetic mean of a ...
. That the cross-covariance and cross-correlation are independent of t is precisely the additional information (beyond being individually wide-sense stationary) conveyed by the requirement that (X_t, Y_t) are ''jointly'' wide-sense stationary.
The cross-correlation of a pair of jointly wide sense stationary stochastic processes can be estimated by averaging the product of samples measured from one process and samples measured from the other (and its time shifts). The samples included in the average can be an arbitrary subset of all the samples in the signal (e.g., samples within a finite time window or a sub-sampling of one of the signals). For a large number of samples, the average converges to the true cross-correlation.
Normalization
It is common practice in some disciplines (e.g. statistics and time series analysis
In mathematics, a time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data. ...
) to normalize the cross-correlation function to get a time-dependent Pearson correlation coefficient
In statistics, the Pearson correlation coefficient (PCC, pronounced ) ― also known as Pearson's ''r'', the Pearson product-moment correlation coefficient (PPMCC), the bivariate correlation, or colloquially simply as the correlation coefficien ...
. However, in other disciplines (e.g. engineering) the normalization is usually dropped and the terms "cross-correlation" and "cross-covariance" are used interchangeably.
The definition of the normalized cross-correlation of a stochastic process is
\rho_(t_1, t_2) =
\frac =
\frac
If the function \rho_ is well-defined, its value must lie in the range 1,1/math>, with 1 indicating perfect correlation and −1 indicating perfect anti-correlation.
For jointly wide-sense stationary stochastic processes, the definition is
\rho_(\tau) =
\frac =
\frac
The normalization is important both because the interpretation of the autocorrelation as a correlation provides a scale-free measure of the strength of statistical dependence
Independence is a fundamental notion in probability theory, as in statistics and the theory of stochastic processes. Two events are independent, statistically independent, or stochastically independent if, informally speaking, the occurrence o ...
, and because the normalization has an effect on the statistical properties of the estimated autocorrelations.
Properties
Symmetry property
For jointly wide-sense stationary stochastic processes, the cross-correlation function has the following symmetry property:[Kun Il Park, Fundamentals of Probability and Stochastic Processes with Applications to Communications, Springer, 2018, 978-3-319-68074-3]\operatorname_(t_1, t_2) = \overlineRespectively for jointly WSS processes:\operatorname_(\tau) = \overline
Time delay analysis
Cross-correlations are useful for determining the time delay between two signals, e.g., for determining time delays for the propagation of acoustic signals across a microphone array. After calculating the cross-correlation between the two signals, the maximum (or minimum if the signals are negatively correlated) of the cross-correlation function indicates the point in time where the signals are best aligned; i.e., the time delay between the two signals is determined by the argument of the maximum, or arg max of the cross-correlation, as in\tau_\mathrm=\underset((f \star g)(t))Terminology in image processing
Zero-normalized cross-correlation (ZNCC)
For image-processing applications in which the brightness of the image and template can vary due to lighting and exposure conditions, the images can be first normalized. This is typically done at every step by subtracting the mean and dividing by the standard deviation. That is, the cross-correlation of a template t(x,y) with a subimage f(x,y) is\frac \sum_\frac\left(f(x,y) - \mu_f \right)\left(t(x,y) - \mu_t \right)where n is the number of pixels in t(x,y) and f(x,y),
\mu_f is the average of f and \sigma_f is standard deviation of f.
In functional analysis
Functional analysis is a branch of mathematical analysis, the core of which is formed by the study of vector spaces endowed with some kind of limit-related structure (e.g. inner product, norm, topology, etc.) and the linear functions defined ...
terms, this can be thought of as the dot product of two normalized vectors. That is, ifF(x,y) = f(x,y) - \mu_fandT(x,y) = t(x,y) - \mu_tthen the above sum is equal to\left\langle\frac,\frac\right\ranglewhere \langle\cdot,\cdot\rangle is the inner product
In mathematics, an inner product space (or, rarely, a Hausdorff pre-Hilbert space) is a real vector space or a complex vector space with an operation called an inner product. The inner product of two vectors in the space is a scalar, often ...
and \, \cdot\, is the ''L''² norm. Cauchy–Schwarz then implies that ZNCC has a range of 1, 1/math>.
Thus, if f and t are real matrices, their normalized cross-correlation equals the cosine of the angle between the unit vectors F and T, being thus 1 if and only if F equals T multiplied by a positive scalar.
Normalized correlation is one of the methods used for template matching, a process used for finding instances of a pattern or object within an image. It is also the 2-dimensional version of Pearson product-moment correlation coefficient
In statistics, the Pearson correlation coefficient (PCC, pronounced ) ― also known as Pearson's ''r'', the Pearson product-moment correlation coefficient (PPMCC), the bivariate correlation, or colloquially simply as the correlation coefficien ...
.
Normalized cross-correlation (NCC)
NCC is similar to ZNCC with the only difference of not subtracting the local mean value of intensities:\frac \sum_\frac f(x,y) t(x,y)
Nonlinear systems
Caution must be applied when using cross correlation for nonlinear systems. In certain circumstances, which depend on the properties of the input, cross correlation between the input and output of a system with nonlinear dynamics can be completely blind to certain nonlinear effects. This problem arises because some quadratic moments can equal zero and this can incorrectly suggest that there is little "correlation" (in the sense of statistical dependence) between two signals, when in fact the two signals are strongly related by nonlinear dynamics.
See also
* Autocorrelation
Autocorrelation, sometimes known as serial correlation in the discrete time case, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations of a random variable ...
* Autocovariance
* Coherence
Coherence, coherency, or coherent may refer to the following:
Physics
* Coherence (physics), an ideal property of waves that enables stationary (i.e. temporally and spatially constant) interference
* Coherence (units of measurement), a deriv ...
* Convolution
In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution' ...
* Correlation
In statistics, correlation or dependence is any statistical relationship, whether causal or not, between two random variables or bivariate data. Although in the broadest sense, "correlation" may indicate any type of association, in statisti ...
* Correlation function
* Cross-correlation matrix
* Cross-covariance
* Cross-spectrum
* Digital image correlation
* Phase correlation
* Scaled correlation
* Spectral density
* Wiener–Khinchin theorem
In applied mathematics, the Wiener–Khinchin theorem or Wiener–Khintchine theorem, also known as the Wiener–Khinchin–Einstein theorem or the Khinchin–Kolmogorov theorem, states that the autocorrelation function of a wide-sense-stationary ...
References
Further reading
*
External links
Cross Correlation from Mathworld
* http://scribblethink.org/Work/nvisionInterface/nip.html
* http://www.staff.ncl.ac.uk/oliver.hinton/eee305/Chapter6.pdf
{{Statistics, analysis
Bilinear maps
Covariance and correlation
Signal processing
Time domain analysis