# Tag Info

## Hot answers tagged cross-correlation

42

The only difference between cross-correlation and convolution is a time reversal on one of the inputs. Discrete convolution and cross-correlation are defined as follows (for real signals; I neglected the conjugates needed when the signals are complex): $$x[n] * h[n] = \sum_{k=0}^{\infty}h[k] x[n-k]$$ $$corr(x[n],h[n]) = \sum_{k=0}^{\infty}h[k] x[n+k]$$ ...

12

For continuous convolution $$[Hf](x) \equiv f(x) * h(x) \equiv \int\mathrm{d}x' h(x-x')f(x')$$ and continuous cross-correlation $$[Gf](x) \equiv f(x) \star h(x) \equiv \int \mathrm{d}x'h^*(x'-x)f(x')$$ It's easy to show that the cross-correlation operator $G$ is the adjoint operator of the the convolution operator $H$. Also, the convolution operation is ...

12

It's not cheating, and it's also not adding any new information. What you are doing is the same thing that any upsampling LPF is doing- adding zeros and then reconstructing the waveform with the already known frequency information. Thus, there is no new information, but there is still finer time resolution. Upsampling the result is similar- no new ...

11

@NickS Since it is far from certain that the second signal in the plots is in fact a solely delayed version of the first, other methods besides the classical cross-correlation have to be attempted. This is because the cross-correlation (CC) is merely a maximum likelihood estimator if your signal(s) are delayed versions of each other. In this case, they are ...

10

One-dimensional version The one-dimensional version that you list won't work. When there is a large enough shift in images (more than one or two pixels in real-world images), there will be nothing relating the column pixels. For an example of this, try: I5 = rand(100,100)*255; I6 = zeros(100,100); I6(11:100,22:100) = I5(1:90,1:79); So that we have I5: ...

9

A few elements... (I know that this is not exhaustive, a more complete answer should probably mention moments) Q1 To check whether two distributions are independent, you need to measure how similar their joint distribution $p(x,y)$ is to the product of their marginal distribution $p(x) \times p(y)$. To this purpose, you can use any distance between ...

9

If the linear system (does not have to be time-invariant) is bounded-input bounded-output (BIBO) stable (meaning that if $|x(t)| \leq M$ for all $t$ for some finite positive number $M$, then there is another finite positive number $M^\prime$ such that $|y(t)| \leq M^\prime$ for all $t$), then when the input is a finite-variance random process (a.k.a. ...

9

As I've said in the comments, medical image registration is a topic with lots of research available, and I'm not an expert. From what I've read, the basic idea commonly used is to define a mapping between two images (in your case an image and its mirror image), then define energy terms for smoothness and for image similarity if the mapping is applied, and ...

8

Any bandlimited signal can be interpolated. The additional information "between the samples" is contained in the adjacent samples plus the fact that the signal was bandlimited before sampling (which tends to spread information among adjacent samples). If two signals are bandlimited, than so will be the cross-correlation, so the cross-correlation can be ...

8

Are you sure you shouldn't be using numpy.correlate instead of numpy.convolve? To estimate delay, you want to cross-correlate your signals, not convolve them. You'll possibly end up with a much larger delay by convolving. Trying something simple: x = [1, 0, 0, 0, 0 ]; y = [0, 0, 0, 0, 1 ]; conv = numpy.convolve(x,y); conv array([0, 0, 0, 0, 1, 0, 0, 0, ...

7

No. If the words are pronounced with a different speed or intonation (prosody), or by different speakers, the cross-correlation won't have any significance. A solution more robust to changes in prosody is to use audio features which are less dependent on pitch (such as MFCCs), and a comparison method that is robust to local time stretching (such as DTW or a ...

7

I can tell you of at least three applications related to audio. Auto-correlation can be used over a changing block (a collection of) many audio samples to find the pitch. Very useful for musical and speech related applications. Cross-correlation is used all the time in hearing research as a model for what the left and ear and the right ear use to figure ...

7

Let $\theta_a$ and $\theta_c$ respectively denote the maximum magnitudes of the off-peak or out-of-phase periodic autocorrelation functions and the periodic crosscorrelation functions of a set of $K$ sequences of length $N$ and energy $\sum_{n=0}^{N-1}|x[n]]|^2 = N$. In a seminal paper published in 1974, Welch proved that $$\max\big(\theta_a, \theta_c\big)\... 7 No. Quoting Wikipedia's article Independence (probability theory): If X and Y are independent random variables, then the expectation operator \operatorname{E} has the property$$\operatorname{E}[X Y] = \operatorname{E}[X]\operatorname{E}[Y].$$Consider your X(t_1) and Y(t_2) as X and Y in this answer. If both \operatorname{E}[X] \ne ... 6 There are a few problems doing this with autocorrelation Huge DC offset (fixed already) Time window: Matlab's xcorr() has the annoying convention to essentially "zero pad" the signal at both ends as you slide the time lag. I.e. the data window is a function of time lag. This will create a triangular shape for any stationary signal (including sine waves). ... 6 As a student I was involved in the same problem as you are. Let me explain to you in the simplest words without any math. Convolution: It is used to convolute two function. May sound redundant but I´ll put an example: You want to convolute (in a non math term to "combine") a unit cell (which can contain anything you want: protein, image, etc) and a ... 6 Use an onset detector - a classic method is described in Duxbury's paper "A combined phase and amplitude based approach to onset detection for audio segmentation". If you want a ready to use solution, you can use Sonic Visualizer / Sonic annotator, which can export onset positions as a text file. It works well for your example, with only one false positive -... 6 This is basically what @hooman suggests: fit a parabola to the three points near the peak of the sample cross-correlation of the data. Using the formula for p here:$$ p = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma} $$where \alpha,\beta, and \gamma are the values of the sample cross-correlation just before the peak, at the peak, and ... 5 I think using cross-correlation and interpolating the peak would work fine. As described in Is up-sampling prior to cross-correlation useless?, interpolating or upsampling before the cross-correlation doesn't actually get you any more information. The information about the sub-sample peak is contained in the samples around it. You just need to extract it ... 5 Inferring whether two signals are independent is very hard to do (given finite observations) without any prior knowledge/assumptions. Two random variable X and Y are independent if the value of X doesn't give any information about the value of Y (i.e. doesn't affect our prior probability distribution for Y). This is equivalent to any nonlinear ... 5 What you've listed is a classical set of linear equations known as the Wiener-Hopf Equations. There are many methods to solve this set of equations. These equations generalize the Yule-Walker equations for Autoregressive (AR) modeling. In fact, if the Wiener-Hopf equations are used to solve for a linear predictor of your signal, the equations are identical ... 5 There is no such thing as the phase angle between two signals unless they both consist of a single sinusoid at the same frequency, that is, x(t) = A\cos(\omega t+\psi) and y(t) = B\cos(\omega t + \phi). If you have N samples of these signals x(t) and y(t), taken at times 0, T, 2T, \ldots, (N-1)T, so that$$x[n] = x(nT), ~~ y[n] = y(nT), 0 \...

5

I guess you can compute for each pixel the correlation coefficient between patches centered on this pixel in the two images of interest. Here is an example where I downloaded the figure attached here and tried to compute the correlation in such a way. The output looks different from the one of the article, but it was to be expected since the resolution is ...

5

I suppose you mean the cross-correlation at lag zero. Well take an Hilbert space $H$ (i.e. a metric space in which you can define a scalar product $\langle\cdot ,\cdot\rangle$). Then $x,y\in H$ are orthogonal if $\langle x,y\rangle=0$, by definition. If your Hilbert Space is $L_2(\mathbb{R})$ (the space of real square integrable functions) then the scalar ...

5

What are reasons to choose for cross-correlation or cross-covariance when comparing signals with non-zero mean? Well, part of the issue is that cross-correlation as defined in your equation: $$(f \star g)[n]\ \stackrel{\mathrm{def}}{=} \sum_{m=-\infty}^{\infty} f^*[m]\ g[m+n].$$ will not exist (or be infinite) if $f$ and $g$ have non-zero mean. So, in ...

5

The general topic of finding similarities between signals is wide ranging: are the signals of same sampling, length, offset, shift or scale? where do they take their values (discrete, real, complex)? are they stationary? noisy? what do you consider similar (whole signals, chunks, specific features)? which are the invariances looked for? and most important:...

5

Lagrange parabolic estimator The standard Lagrange polynomial parabolic interpolation peak finding formula from Peter's answer, $$p = \frac{1}{2} \frac{\alpha - \gamma}{\alpha - 2\beta + \gamma}$$ has bias as function of the true delay $d$ if the cross-correlation peak is that of a critically sampled sinc. If the sampling frequency is increased, the ...

5

Cross correlation is a measure of similarity between two signals, where one signal is allowed to be time-shifted. In this sense, the correlation is not a single number, but a function of the time shift. We say, "these two signal have a certain correlation $R(\Delta)$ for a time shift $\Delta$". Intuitively, two signals that tend to have the same sign (both ...

5

Since this is an FIR, the group delay is D=(N-1)/2=20 samples. No, since this is a linear phase (i.e. symmetric or anti-symmetric) filter, the group delay is half the length! (being a FIR isn't sufficient.) The issue is that I get too peaks in the cross correlation, one at zero lag and another at 20 lag. Write down the formula for auto-correlation at ...

4

As the others have pointed out, and it seems you have realized based on your last edit to the question, it doesn't appear that cross-correlation is going to give you a good estimate of time delay for the datasets shown. Correlation measures similarity in shape between two time series by sliding one across the other for a range of time lags and computing an ...

Only top voted, non community-wiki answers of a minimum length are eligible