Issue
This is the MSE formula.
And here are two python functions to calculate MSE for two RGB images. They get the same result. But the result is much more greater than 1.0 such as 43.0, 58.0...
While the MSE(L2 error) in almost all papers are all much smaller than 1.0 such as 0.05, 0.08...
And I want to know how to calculate the MSE results in papers such as 0.05, 0.08.
def mse_1(img_a,img_b):
mse = np.mean( (img_a - img_b) ** 2 )
return mse
def mse_2(img_a,img_b):
cnt = img_a.shape[0]*img_a.shape[1]
mse_r = (float)(np.sum((img_a[:,:,0] - img_b[:,:,0]) ** 2)) / (float)(cnt)
mse_g = (float)(np.sum((img_a[:,:,1] - img_b[:,:,1]) ** 2)) / (float)(cnt)
mse_b = (float)(np.sum((img_a[:,:,2] - img_b[:,:,2]) ** 2)) / (float)(cnt)
mse = (mse_r+mse_g+mse_b)/3.0
return mse
Can someone help me?
Solution
Note: You can try few ranges such as [0,1] and [0,1] for normalization. Also if the normalization solves your issue please accept this as the answer so other users wont lose time coming up with other possible answers such as explaining image scaling. If It doest work let me know and I will delete/edit this answer and help you furter.
Answered By - Cem Koçak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.