How to find the maximum point of correlation in matlab for two similar images..

조회 수: 4 (최근 30일)
I would like to know how to find the point which has the maximum correlation of two images. I already found out the program for correlation of two similar images . But now, i have to know the point at which the correlation is maximum.I have to add the command lines to find the maximum point of correlation. The program is:-
Img1 = imread('C:\Users\DELL\Desktop\Natures\Nature1.jpg'); Img2 = imread('C:\Users\DELL\Desktop\Natures\Nature2.jpg');
N = 500;
range = 1:N; da = [0 20]; db = [30 30]; dc = [0 20]; dd = [30 30]; A=Img1(da(1) + range, da(2) + range); B=Img1(db(1) + range, db(2) + range); C=Img2(dc(1) + range, dc(2) + range); D=Img2(dd(1) + range, dd(2) + range);
X = normxcorr2(A, B); m = max(X(:)); [i,j] = find(X == m);
Y = normxcorr2(C, D); m = max(Y(:)); [k,l] = find(Y == m);
R = zeros(2*N, 2*N); R(N + range, N + range) = B; R(i + range, j + range) = A; R(N + range, N + range) = D; R(k + range, l + range) = C; figure subplot(2,2,1), imagesc(A) subplot(2,2,2), imagesc(B) subplot(2,2,3), imagesc(X) rectangle('Position', [j-1 i-1 2 2]), line([N j], [N i]) subplot(2,2,4), imagesc®;
subplot(2,2,1), imagesc(C) subplot(2,2,2), imagesc(D) subplot(2,2,3), imagesc(Y) rectangle('Position', [l-1 k-1 2 2]), line([N l], [N k]) subplot(2,2,4), imagesc(S); delta_orig1 = da - db %--> [30 10] delta_recovered = [i - N, j - N] %--> [30 10] delta_orig2 = dc - dd %--> [30 10] delta_recovered = [k - N, l - N] %--> [30 10]

채택된 답변

Matt J
Matt J 2021년 7월 14일
  댓글 수: 1
AHMED FARZEEN THALAYAN KANDY
AHMED FARZEEN THALAYAN KANDY 2021년 7월 23일
Thank u very much for this answer. I would like to know further.. how to find the displacement across x and y direction and the difference in angle between them.. Would be of great use so that i can include that part to the program... Thank you in advance...

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

추가 답변 (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