【发布时间】:2017-03-27 05:16:33
【问题描述】:
我有一张图像,我正在尝试计算 R_h[x], R_v[x], -50<=x<=50 的水平和垂直自相关函数估计值。我听说我可以使用corr2() 来完成此操作,但我不确定如何。
【问题讨论】:
标签: matlab image-processing correlation
我有一张图像,我正在尝试计算 R_h[x], R_v[x], -50<=x<=50 的水平和垂直自相关函数估计值。我听说我可以使用corr2() 来完成此操作,但我不确定如何。
【问题讨论】:
标签: matlab image-processing correlation
您可以结合使用circshift(将图像偏移一定数量)和corr2 来计算原始图像和偏移图像之间的相关性。您只需要遍历要检查的值。例如:
img = peaks(100); % Sample data
x = -50:50; % Desired offsets
output = zeros(1,101); %preallocate space for the result
for i=x % loop over the offsets
img2=circshift(img,[i 0]); % Shift the image by the desired lag
output(i+51)=corr2(img,img2); % Calculate the correlation between the offset image and the original
end
plot(x,output)
我认为您可以从这里获取其他维度的相同图表,甚至可以获取水平和垂直维度的变化组合的矩阵。
【讨论】:
你可以看看corr2() documentation。
基本上这样就可以了:
mInputImage1 = randn([200, 200]);
mInputImage2 = medfilt2(randn([200, 200]));
mCorrImage = corr2(mInputImage1, mInputImage2);
【讨论】: