Oh, forgot to mention. The array dimensions are dependent on the input image shape as well as the neighbourhood definition, so the difference is zeros(len(img.shape), neighbourhood_size).