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 Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by