Finding the cross correlation coefficient between consecutive images
3 views (last 30 days)
Show older comments
Niels Visser
on 18 May 2019
Commented: Niels Visser
on 21 May 2019
First of all I want to say that i'm compeletly new to Matlab.
I'm currently working Kikuchi pattern which is sort of an image of diffraction bands inside a crystal. When moving to a so-called 'grain boundary' these patterns slowly changes to an other pattern(whatever that pattern may be). The point is; I have a hole bunch of consecutive images(moving from one side of the grain boundary to the other side), and every image I want to cross correlate to the next image. Hence getting a the cross correlation coefficient between image_i and image_(i+1), the next corrcoeff. is then between image_(i+1) and image_(i+2) and so forth.
I know how to read in each image and i know the general expression in Matlab for the cross correlation coefficient between two images. The problem is how to generate the whole bunch of coefficients? Should I use a while loop for instance? Is there a way to read in all images once at a time, and labeling them accordingly? Sorry for the lots of questions, but i'm completely new to Matlab.
A=imread('image_1.jpg'); %reading in first image%
B=imread('image_2.jpg'); %reading in second image%
C=corr2(A,B); %calculating crosscoeff between A and B%
0 Comments
Accepted Answer
KALYAN ACHARJYA
on 18 May 2019
Edited: KALYAN ACHARJYA
on 18 May 2019
% Make sure that all images are in same working directory (current directory)
% Rename as sequential order im1,im2 etc
list=dir('*.jpg');
for j=1:length(list)-1
A=imread(list(j).name);
B=imread(list(j+1).name);
C(j)=corr2(A,B);
end
More Answers (0)
See Also
Categories
Find more on Geometric Transformation and Image Registration 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!