回答
对于两个画面A,B你把所述的每一个象素和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)
你可以看看下面的文章:http://en.wikipedia.org/wiki/Mean_squared_error#Definition_and_basic_properties。 “Yi”表示真值,“hat_Yi”表示我们想要比较真值的值。
所以,你的情况,你可以考虑一个图像作为参考图像,将其像素值你想用第一个比较形象的第二图像....你通过计算MSE这样做哪些告诉你“第二张图像与第一张图像的差异/相似程度如何”
让我们假设你在二维空间A(x1,y1
)和B(x2,y2
)中有两个点,两点之间的距离是计算为sqrt((x1-x2)^2+(y1-y2)^2)
。如果两点在三维空间中,则可以计算为sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)
。对于n维空间中的两点,距离公式可以扩展为sqrt(sumacrossdimensions(valueofAindim-valueofBindim)^2)
(因为乳胶是不允许的)。现在
,具有n个像素的图像可以被看作是在n维空间中的点。具有n个像素的两个图像之间的距离可以被认为是n维空间中的2个点之间的距离。这个距离被称为MSE
。
在均方根误差中没有平方根 – user151496
正如user161496所示。如果你使用平方根,那么你正在计算RMSE(均方根误差) – fmw42
检查出MSE维基百科,它的每个像素值之间的差的量度。下面是一个示例实现
def MSE(img1, img2):
squared_diff = (img1 -img2) ** 2
summed = np.sum(squared_diff)
num_pix = img1.shape[0] * img1.shape[1] #img1 and 2 should have same shape
err = summed/num_pix
return err
概念,那就是:
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
注意,在错误的E是与差的代名词。所以它可以被称为均方差。也意味着与平均水平相同。所以它也可以称为平均平方差。
- 1. 计算MSE(均方误差)
- 2. 计算平均绝对误差之间的两个图像MATLAB
- 3. 打破平局是什么意思?
- 4. 不平衡#endif是什么意思
- 5. 训练集的平均误差等于测试集的平均误差?
- 6. 什么是萤火虫错误$(平均
- 7. 什么是“cgi.parse_qs”平均
- 8. 是什么@synchronized平均
- 9. 得到平均数
- 10. “char(&(...))[2]”是什么意思?
- 11. (10%2)是什么意思?
- 12. 意思是因子水平
- 13. 是什么意思:是什么意思?
- 14. 如果泊松分布均值和方差不相同,比如说平均值大于方差或方差大于平均值,那么选择模型?
- 15. 均方误差(MSE)返回一个庞大的数字
- 16. R 2个逗号是什么意思?
- 17. 对于昵称,“ContactsContract.CommonDataKinds.Nickname.CONTENT_ITEM_TYPE”是什么意思?
- 18. x的平均值的误差线除以y的平均值
- 19. 图像的相位是什么意思?
- 20. 这是什么意思?图像/ PNG; BASE64?
- 21. “〜方法”是什么意思?
- 22. 计算平均MAPE和MSE的有效方法R
- 23. 图上的上方是什么意思?
- 24. 错误是什么意思?
- 25. 如何平均一组图像并使用MATLAB将平均图像保存为平均图像
- 26. 对矢量图进行平均以获得中间图像
- 27. 指定rnorm的平均值/标准偏差向量是什么?
- 28. 得到平均数据框
- 29. 得到平均列A
- 30. 0x0F是什么意思?这个代码是什么意思?
这是许多不同的可能措施之一。 –