user1595450
user1595450

Reputation: 31

Calculate covariance of two images in matlab

I am doing a project on image quality assessment. I converted the image to grayscale & divided the entire image into 8x8 matrices using mat2cell function. I did this for two images, and now I want to calculate covariance between these two images (i.e the covariance between the matrix of image 1 and covariance between the same matrix of image 2). Note that both are the same images: one a pure image without distortions and one with distortions.

Upvotes: 2

Views: 6667

Answers (2)

Amsini
Amsini

Reputation: 1

For single matrix input, C has size [size(A,2) size(A,2)] based on the number of random variables (columns) represented by A. The variances of the columns are along the diagonal. If A is a row or column vector, C is the scalar-valued variance.

For two-vector or two-matrix input, C is the 2-by-2 covariance matrix between the two random variables. The variances are along the diagonal of C.

Upvotes: 0

Amir
Amir

Reputation: 643

First convert your image to matrix:

I = double(imread('photo.jpg'));

then calculate covariance:

x=cov(I);

Upvotes: 1

Related Questions