The difference and the average value of the image

I calculate the average and variance of my original and stego image to compare them. I use a black and white BMP image for comaprison

image=imread("image name")
M = mean(image(:))
V = var((image(:)))

Is this the correct way to calculate the mean / var in MATLAB? My variation is getting more than average.

Any help is appreciated.

+5
source share
2 answers

This is really the right way to calculate the average and variance for all pixels in your image.

It is possible that your deviation is more than average, since both are determined as follows:

mean     = sum(x)/length(x)
variance = sum((x - mean(x)).^2)/(length(x) - 1);

, randn(N,1), N, , 0 1. , .

: , (.. , , 50% ,...). , , . , : . 50%, 50% ( ) 50 50 ( )? , , (.. , ).

edit:. RMS ( ) , , DC (.. ) RMS.

edit 2: : . , ( , ), ( ^ 2). (std MATLAB), , , , , ( , ).

+8

RGB (H x W x 3), . 3- .

for ch = 1:3
   M(ch) = mean(reshape(img(:,:,ch),[],1));
   V(ch) = var(reshape(img(:,:,ch),[],1));
end

MATLAB image. .

+5

All Articles