cross-correlation

Cross correlation of different time series data values in R

最后都变了- 提交于 2020-01-24 09:36:06
问题 I have a time series data (in day format) of 5 places for 15 days stored as a matrix . The structure of data is meter_daywise<-structure(c(24.4745528484842, 21.5936510486629, 58.9120896540103, 49.4188338105575, 568.791971631185, 27.1682608244523, 23.3482757939878, 74.710966227615, 82.6947717673258, 704.212340152625, 23.7581651139442, 21.154634543401, 64.9680107059625, 420.903181621575, 672.629513512841, 128.22871420984, 601.521395359887, 74.6606087800009, 335.87599588534, 576.451039365565,

Aligning sequences with missing values

末鹿安然 提交于 2020-01-02 07:08:35
问题 The language I'm using is R, but you don't necessarily need to know about R to answer the question. Question: I have a sequence that can be considered the ground truth, and another sequence that is a shifted version of the first, with some missing values. I'd like to know how to align the two. setup I have a sequence ground.truth that is basically a set of times: ground.truth <- rep( seq(1,by=4,length.out=10), 5 ) + rep( seq(0,length.out=5,by=4*10+30), each=10 ) Think of ground.truth as times

numpy and statsmodels give different values when calculating correlations, How to interpret this?

我的未来我决定 提交于 2020-01-02 04:55:30
问题 I can't find a reason why calculating the correlation between two series A and B using numpy.correlate gives me different results than the ones I obtain using statsmodels.tsa.stattools.ccf Here's an example of this difference I mention: import numpy as np from matplotlib import pyplot as plt from statsmodels.tsa.stattools import ccf #Calculate correlation using numpy.correlate def corr(x,y): result = numpy.correlate(x, y, mode='full') return result[result.size/2:] #This are the data series I

loop over all possible combinations

梦想与她 提交于 2019-12-24 09:59:06
问题 I would like to include a loop in my script which finds the correlation of every possible combination of the data. This can be done manually by the following code: clear all %generate fake data LName={'Name1','Name2','Name3'}; Data={rand(12,1),rand(12,1),rand(12,1)}; %place in a structure d = [LName;Data]; Data = struct(d{:}); %find the correlation [R,P] = corrcoef(Data.Name1,Data.Name2); [R2,P2] = corrcoef(Data.Name1,Data.Name3); [R3,P3] = corrcoef(Data.Name2,Data.Name3); However, I would

Tackle low FPS for correlation code to compute shift in Image

蹲街弑〆低调 提交于 2019-12-24 00:55:56
问题 I am trying to track an object using correlation. I am finding a smaller patch in a larger image, frame by frame. For this, I am finding the shift in the patch, and where correlation is maximum, update the patch with a new patch. My code is: cv::Mat im_float_2,imagePart_out; cv::Mat im_floatBig; cv::Scalar im1_Mean, im1_Std, im2_Mean, im2_Std; double covar, correl; int n_pixels; void computeShift() { int maxRow=0, maxCol=0, TX, TY; double GMAX=0; Mat image_window = Mat::zeros(imagePart.rows,

Normalized Cross-Correlation in Python

回眸只為那壹抹淺笑 提交于 2019-12-23 07:28:19
问题 I have been struggling the last days trying to compute the degrees of freedom of two pair of vectors (x and y) following reference of Chelton (1983) which is: degrees of freedom according to Chelton(1983) and I can't find a proper way to calculate the normalized cross correlation function using np.correlate, I always get an output that it isn't in between -1, 1. Is there any easy way to get the cross correlation function normalized in order to compute the degrees of freedom of two vectors?

Performing a phase correlation with fft in R

痞子三分冷 提交于 2019-12-21 05:47:09
问题 I am trying to implement a 2d phase correlation algorithm in R using a recipe from Wikipedia (http://en.wikipedia.org/wiki/Phase_correlation) in order to track the movement between 2 images. These images (frames) were captured with a camera shaking in the wind and the ultimate goal is to remove the shake in these and subsequent frames. The two example images and the R code are below: ## we will need the tiff library library(tiff) ## read in the tiff files f1=as.matrix(readTIFF('f1.tiff'

Explaing Cross Correlation and Normalization for openCV's Match Template

纵然是瞬间 提交于 2019-12-20 09:45:19
问题 My boss and I disagree as to what is going on with the CV_TM_CCORR_NORMED method for matchTemplate(); in openCV. Can you please explain what is happening here especially the square root aspect of this equation. 回答1: Correlation is similarity of two signals,vectors etc. Suppose you have vectors template=[0 1 0 0 1 0 ] A=[0 1 1 1 0 0] B =[ 1 0 0 0 0 1] if you perform correlation between vectors and template to get which one is more similar ,you will see A is similar to template more than B

Matlab: xcorr 1d cross-correlation normalisation issue

允我心安 提交于 2019-12-20 07:26:03
问题 I have a reference signal (s1) of length = 5 and another signal (s2) of length = 25 samples (containing a shifted version of the same 5 sample signal s1). I want to find the normalised cross correlation between the two signals to calculate the sample distance (delay / lag) between signals s1 and s2. I pad s1 with zeros (so it is the same length as s2 as required for xcorr 'coeff' option): s1(numel(s2)) = 0; and then do: [R lags]=xcorr(s2,s1,'coeff'); [vm im]=max(R); %max. correlation and

cross-correlation using ccf in R [closed]

非 Y 不嫁゛ 提交于 2019-12-19 11:48:20
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I wanted to use ccf in R to compute the cross-correlation on two sets of time-series data. My question is how can I know if any of the correlation coefficients in the plot falls outside the dash blue lines