opencv中matlab blockprop的等价物是什么

what is the equivalent of matlab blockprop in opencv

opencv中的blockproc相当于什么?

http://www.mathworks.com/help/images/ref/blockproc.html?refresh=true

我想将图像分成 3X3 块,并对每个块应用平均值。

不行,需要手动操作

http://answers.opencv.org/question/33258/how-to-cut-an-image-in-small-images-with-opencv/

使用 python 绑定时,我们可以执行以下操作

import cv2 
import numpy as np



mat = cv2.imread('x.jpg')

rows, cols, x = mat.shape 
rows, cols = 3*(rows/3),  3*(cols/3) 
reshaped = mat[:rows,:cols].reshape(rows//3, 3, cols//3, 3,3) 
mat1 = reshaped.sum(axis=(1, 3)) / 9

cv2.imwrite('y.jpg', mat1.astype(np.uint8))