Finding the cross correlation coefficient between consecutive images

6 visualizaciones (últimos 30 días)
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%

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 18 de Mayo de 2019
Editada: KALYAN ACHARJYA el 18 de Mayo de 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
  1 comentario
Niels Visser
Niels Visser el 21 de Mayo de 2019
Allright thank you! Is this also possible to read in some matrices instead of images? If so, which statement should I change?

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by