How to do correlation between two tiff image files?

Respuestas (2)

KALYAN ACHARJYA
KALYAN ACHARJYA el 7 de Mzo. de 2019
Editada: madhan ravi el 7 de Mzo. de 2019
im1=imread('image1.tif');
im2=imread('image2.tif');
result=corr2(im1,im2);
Note: If the input images are RGB, convert both images in gray and apply corr2.
Please ensure that both images having same size.

3 comentarios

Thara C.S
Thara C.S el 8 de Mzo. de 2019
ok, cant we get a graph of correlation in matlab?
the result is a value!
Direct corelation gives a number, if you are looking for matrics, please look on Correlation coefficients
im1=double(rgb2gray(imread('21_training.tif')));
im2=double(rgb2gray(imread('25_training.tif')));
R=corrcoef(im1,im2)
R =
1.0000 0.9419
0.9419 1.0000
But I dont know wheather it serves the main objective of your problem or not?
You can find the corrcoef of single matrix, which returns a matrix of coefficients.
im1=double(gray_image);
R=corrcoef(im1)
Thara C.S
Thara C.S el 11 de Mzo. de 2019
but,
i need a graphical representation of pixel wise correlation between two tiif images?

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 11 de Mzo. de 2019
Try xcorr2():
correlationImage = xcorr2(image1, image2);
imshow(correlationImage, []);
It will give an image of the spatial correlation of image1 with image2. From that you can get profiles if you want.

4 comentarios

the process is taking too long, what do you think is the reason
Your images are probably too big. You might want to do it in the Fourier domain by multiplying their FT then inverse FT.
How to print the resulting tif file into a folder
You can use imwrite(). If correlationImage is double, then convert to uint8 and then call imwrite():
uint8Image = uint8(mat2gray(correlationImage));
imwrite(uint8Image, fileName);

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 7 de Mzo. de 2019

Comentada:

el 16 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by