Max. Drilling pool

Edit:

What I really wanted to do was find local maxima, which are explained well below, and the same solution is also explained here:

http://scikit-image.org/docs/dev/auto_examples/plot_peak_local_max.html




It seems you can do linear convolution in Numpy.

Is it possible to convolve non-linear maximum pools? Use the NxM patch and step over the input image, zeroing out the current pixel if it is not maximum in the neighborhood?

So nonlinear max convolution works like this: here is my image

3 4 5 2 3 3 5 1 2 7 2 2 5 1 7 

And given that a maximum 2x2 pool gives this output

  0 0 5 0 0 0 5 0 0 7 0 0 5 0 7 

You have a 2x2 patch that moves around the image and resets everything, keeping the maximum value.

+6
source share
1 answer

You can use Scipy maximum_filer -

 from scipy.ndimage.filters import maximum_filter arr*(arr == maximum_filter(arr,footprint=np.ones((3,3)))) 

Run Example -

 In [19]: arr Out[19]: array([[3, 4, 5, 2, 3], [3, 5, 1, 2, 7], [2, 2, 5, 6, 7]]) In [20]: arr*(arr == maximum_filter(arr,footprint=np.ones((3,3)))) Out[20]: array([[0, 0, 5, 0, 0], [0, 5, 0, 0, 7], [0, 0, 0, 0, 7]]) 
+6
source

All Articles