How to find the maximum point of correlation in matlab for two similar images..
4 views (last 30 days)
Show older comments
AHMED FARZEEN THALAYAN KANDY
on 13 Jul 2021
Commented: AHMED FARZEEN THALAYAN KANDY
on 23 Jul 2021
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]
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!