def zca_whitening(x, principal_components):
 print (principal_components.shape, x.shape)
 print flatx.shape
 whitex = np.dot(flatx, principal_components)
 x = np.reshape(whitex, (x.shape[0], x.shape[1], x.shape[2]))
 return x

def zca_whitening ( x , principal_components ) : print ( principal_components . shape , x . shape ) print flatx . shape whitex = np . dot ( flatx , principal_components ) x = np . reshape ( whitex , ( x . shape [ 0 ] , x . shape [ 1 ] , x . shape [ 2 ] ) ) return x
apply zca whitening on an image by given principal components matrix .