Finding the cross correlation coefficient between consecutive images

2 ビュー (過去 30 日間)
Niels Visser
Niels Visser 2019 年 5 月 18 日
コメント済み: Niels Visser 2019 年 5 月 21 日
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