Lateral Position Detection and Angle Correction by Image Correlation.
2 views (last 30 days)
Show older comments
I have done Image Correlation using two similar images using Matlab Programs.but in addition, i have to find the lateral position and angle correction, which i find difficult and not able to do.And no one is able to guide me. I have included the program used for correlation below and the results which i got. It would be helpful if i got the program for the same(lateral position detection and angle correction). 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
Answers (0)
See Also
Categories
Find more on Subplots 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!