获得2张图像的(MSE)平均误差的平方是什么意思?

sam*_*ise 3 opencv image imagemagick image-processing

MSE是通道误差平方的平均值。

比较两个相同尺寸的图像意味着什么?

jos*_*efx 5

对于两张图片A,B,您需要求A中每个像素与B中相应像素之间的差的平方,然后求和并除以像素数。

伪代码:

sum = 0.0
for(x = 0; x < width;++x){
   for(y = 0; y < height; ++y){
      difference = (A[x,y] - B[x,y])
      sum = sum + difference*difference
   }
}
mse = sum /(width*height)
printf("The mean square error is %f\n",mse) 
Run Code Online (Sandbox Code Playgroud)


fmw*_*w42 5

从概念上讲,它将是:

1) Start with red channel
2) Compute the difference between each pixel's gray level value in the two image's red channels pixel-by-pixel (redA(0,0)-redB(0,0) etc for all pixel locations.
3) Square the differences of every one of those pixels (redA(0,0)-redB(0,0)^2
4) Compute the sum of the squared difference for all pixels in the red channel
5) Repeat above for the green and blue channels
6) Add the 3 sums together and divide by 3, i.e, (redsum+greensum+bluesum)/3
7) Divide by the area of the image (Width*Height) to form the mean or average, i.e., (redsum+greensum+bluesum)/(3*Width*Height) = MSE
Run Code Online (Sandbox Code Playgroud)


请注意,错误中的 E 与差异同义。所以它可以被称为均方差。平均值也与平均值相同。所以它也可以称为平均平方差。