I want to down sample image by 2.But is there a faster and vectorized way to implement this without using for loops?
import numpy as np
m, n = f.shape
h=np.zeros((m/2,n/2)
for i in range(m/2):
for j in range(n/2):
h[i,j] = f[2*i,2*j]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…