Finding the cross correlation coefficient between consecutive images

6 次查看(过去 30 天)
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%

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-5-18
编辑:KALYAN ACHARJYA 2019-5-18
% 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
  1 个评论
Niels Visser
Niels Visser 2019-5-21
Allright thank you! Is this also possible to read in some matrices instead of images? If so, which statement should I change?

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by