cross-correlation

An elegant way to get the output of `normxcorr2` in a manner similar to 'conv2' - (removing the unwanted edges)

故事扮演 提交于 2019-12-17 21:11:35
问题 Is there an elegant way in Matlab to get the output of normxcorr2 cropped to the size of the image or cropped only to the part of the matrix that does not use zero padded edges in computation? To understand what I mean, consider the conv2 command. There is an optional parameter called shape that can be set to same or valid . C = conv2(A,B,'same'); C = conv2(A,B,'valid'); For example: size( conv2( rand(50,50) , rand(6,6), 'valid') ) ans = 45 45 size( conv2( rand(50,50) , rand(6,6), 'same') )

phase correlation for image stitching (using of Hamming Window)

空扰寡人 提交于 2019-12-12 03:14:35
问题 I use phase correlation for image stitching and it gives good results for most part of my test data. I just stitiching pairs of image left-right and top-bottom(only shift) But there is some strange behaviour. First strange coordinates, I must convert coordinates //if L-R pt.x= src->width-maxloc.x; pt.y= src->height-maxloc.y; if(pt.y>(temp->height/2)) pt.y= -(maxloc.y+1); //if T-B pt.x= src->width-maxloc.x; pt.y= src->height-maxloc.y; if(pt.x>(temp->width/2)) pt.x= -(maxloc.x+1); Then usage of

GCC-PHAT cross correlation in Python

一世执手 提交于 2019-12-12 02:55:20
问题 I am trying to implement GCC-PHAT in python. The approach is similar to the following two links: link1 and link2 It seems the only difference between GCC-PHAT and normal cross-correlation using FFT is the division by the magnitude. Here is my code: import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import rfft, irfft, fftfreq, fft, ifft def xcorr_freq(s1,s2): pad1 = np.zeros(len(s1)) pad2 = np.zeros(len(s2)) s1 = np.hstack([s1,pad1]) s2 = np.hstack([pad2,s2]) f_s1 = fft(s1)

Python cross-correlation not returning correct shift

谁都会走 提交于 2019-12-11 06:14:02
问题 I'm learning about cross-correlation, and to do so I'm running scipy.signal.correlate on some simple examples. However, there are instances for which the maximum of the correlation function does not coincide with the input time shift (even though the correct time shift IS present in dt ). I suspect the issue lies in my definition of dt , but after several iterations I haven't managed to get the shift consistently correct. def cross_corr(a, b, t): ccf = signal.correlate(a,b,mode='full')

How to do un-normalized 2D Cross Correlation in IPP

隐身守侯 提交于 2019-12-11 04:01:45
问题 I'm doing some C++ optimization work and have need of the plain vanilla version of cross correlation without any mean offset or normalization scaling operations. I know that under normal circumstances with image data the influence of brightness is removed using the above means so that only structural similarity can be discerned but in our application brightness is actually needed. I'm using IPP 7.1, does anybody know if there's a means to do this? The next best thing I'll have to do is write

i am trying to write a code to cross correlate a transmitted signal with a received signal to determine the number of samples delay

断了今生、忘了曾经 提交于 2019-12-10 21:35:43
问题 Cross correlation is to be used to measure distance to an aircraft by transmitting a known wide-band signal and correlating the transmitted signal with incoming signals received via the radar reception dish The transmitted signal x(n) is of length N=512 while the received signal y(n) is of length N=2048. y(n)=kx(n-d)+w(n); where 'kx(n-d)' is x(n) delayed by d samples and attenuated by a factor k, and w(n) is reception noise. i am trying to write a MATLAB program to cross correlate x(n) with

Python Fast Implementation of Convolution/Cross-correlation of 3D arrays

岁酱吖の 提交于 2019-12-10 11:55:20
问题 I'm working on calculating convolutions (cross-correlation) of 3D images. Due to the nature of the problem, FFT based approximations of convolution (e.g. scipy fftconvolve) is not desired, and the "direct sum" is the way to go. The images are ~(150, 150, 150) in size, and the largest kernels are ~(40, 40, 40) in size. the images are periodic (has periodic boundary condition, or needs to be padded by the same image) since ~100 such convolutions has to be done for one analysis, the speed of the

Cross correlation using mathdotnet

房东的猫 提交于 2019-12-10 06:20:08
问题 I have recently started using Mathdotnet Numerics statistical package to do data analysis in c#. I am looking for the cross correlation function. Does Mathdotnet have an API for this? Previously I have been using MATLAB xcorr or Python numpy.correlate . So I am looking for a C# equivalent of these. I have looked through their documentation but it isn't very straightforward. https://numerics.mathdotnet.com/api/ 回答1: Correlation can be calculated by any of the methods from MathNet.Numerics

Is Matlab still slower than opencv in C++

这一生的挚爱 提交于 2019-12-07 10:56:57
问题 According to this link and this one, it is said that opencv is much faster than matlab. First link is written in March 2012, second one is a bit later than that. In the first link, it says, "Programs written in OpenCV run much faster than similar programs written in Matlab." and rates Matlab: 2/10 and OpenCV: 9/10 Consider, I have two float Matrix whose size are 1024*1024 ( mat1 and mat2 ). I want to correlate this matrices. In matlab, corr2(mat1,mat2); //70-75 ms In opencv, c++ Mat result(1

Making sense of CCA (Matlab implementation) 2

随声附和 提交于 2019-12-06 12:49:33
问题 I am using CCA for my work and want to understand something. This is my MATLAB code. I have only taken 100 samples to better understand the concepts of CCA. clc;clear all;close all; load carbig; data = [Displacement Horsepower Weight Acceleration MPG]; data(isnan(data))=0; X = data(1:100,1:3); Y = data(1:100,4:5); [wx,wy,~,U,V] = CCA(X,Y); clear Acceleration Cylinders Displacement Horsepower MPG Mfg Model Model_Year Origin Weight when org subplot(1,2,1),plot(U(:,1),V(:,1),'.'); subplot(1,2,2)