How to find cells corresponding to zero lag in an autocorrelation function

조회 수: 2 (최근 30일)
Hi,
I am looking to identify the cells corresponding to zero lag for an autocorrelation function. To do that I wrote the following as input:
I = imread('001.tif');
acf = autocorr2d(I);
[M,N]=size(acf);
lag_x = [1:N]'-ceil((N+1)/2);
lag_y = [1:M]'-ceil((M+1)/2);
[r_0,c_0] = find_r0c0(acf, lag_x,lag_y);
The response I keep getting is: undefined function or variable find_r0c0. How can this be done?
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 9월 4일
편집: KALYAN ACHARJYA 2019년 9월 4일
May be ?
I = imread('2.png');
acf = autocorr2d(I);
[M,N]=size(acf);
lag_x = [1:N]'-ceil((N+1)/2);
lag_y = [1:M]'-ceil((M+1)/2);
[r_0,c_0] = find(acf,lag_x,lag_y);
%..................still ^^ seems issue here

댓글을 달려면 로그인하십시오.

채택된 답변

Ajay Pattassery
Ajay Pattassery 2019년 9월 18일
편집: Ajay Pattassery 2019년 9월 18일
The zero lag produces the highest value in the autocorrelation output. Hence simply finding the maximum value of the autocorrelation matrix and finding its coordinates gives the pixel location.
In the below example xcorr2 functions compute the 2-D autocorrelation.
I = imread('cameraman.tif');
acf = xcorr2(I);
maximum = max(max(acf));
[r_0,c_0]=find(acf==maximum);
Also, the following code will work since the maximum value of the autocorrelation output will be at the middle position.
I = imread('cameraman.tif');
[m,n] = size(I);
r_0 = ceil((m+n-1)/2);
c_0 = ceil((m+n-1)/2);
Refer the following link for further information on xcorr2.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by