:
def block_process(a, blocksize, filt, args):
b = numpy.empty(a.shape)
for row in xrange(0, a.shape[0], blocksize):
for col in xrange(0, a.shape[1], blocksize):
b[row:row + blocksize, col:col + blocksize] = (
filt(a[row:row + blocksize, col:col + blocksize], *args))
return b
- . . filter1(a, filtsize),
block_process(a, blocksize, filter1, (filtsize,))
, - , , .
, , , - .