I have 2 images with size (256,256,3) and I want to calculate the norm-2 of their difference.
# Original Image
np_ori = np.array(icon_original).reshape(1,-1)
# My reconstructed image
np_0 = np.array(icon_0).reshape(1,-1)
If I use numpy.linalg.norm
norm_org_0 = np.linalg.norm(np_ori-np_0)
I get
62735
When I use np.sum(np.abs(x)*2,axis=-1)**(1./2)
np.sum(np.abs(np_ori-np_0)**2,axis=-1)**(1./2)
I get
2207
The results are the same even if I use .reshape(-1)
to turn it to vector
Shouldn't those two produce the same result?
As Divakar mentioned is was a datatype issue. Converting to float64 solved the problem.