What is the correct way to change image channel ordering between channels first and channels last?

I agree with @Qualia ‘s comment, np.moveaxis(a, source, destination) is easier to understand. This does the job:

x = np.zeros((12, 12, 3))
x.shape
#yields: 
(12, 12, 3)

x = np.moveaxis(x, -1, 0)
x.shape
#yields: 
(3, 12, 12)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)