Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python sliding window maximum

## Option A
from scipy.ndimage.filters import maximum_filter as maxf2D
# Store shapes of inputs
N,M = window_size
P,Q = a.shape
# Use 2D max filter and slice out elements not affected by boundary conditions
maxs = maxf2D(a, size=(M,N))
max_Map_Out = maxs[M//2:(M//2)+P-M+1, N//2:(N//2)+Q-N+1]

## option B
from skimage.util.shape import view_as_windows
N,M = window_size
max_Map_Out = view_as_windows(a, (M,N)).max(axis=(-2,-1))
Comment

PREVIOUS NEXT
Code Example
Python :: scale just one column pandas 
Python :: np.column_sytaxck 
Python :: imoport python code 
Python :: py variable space padding 
Python :: custom_settings in scrpay 
Python :: huffepuf 
Python :: antal riksdagsledamöter 
Python :: poisson disc python 
Python :: how to resize image with pillow in django 
Python :: how to get single element from arraylist in numpy arrayt 
Python :: shutil cut poython 
Python :: asp blocking sedular python stackoverflow 
Python :: python selenium canvas fingerprinting 
Python :: loaves 
Python :: command in python to make negative number positive 
Python :: aggregation with f() in django rest api 
Python :: python print to string 
Python :: django cms create page programmatically 
Python :: python numpy find local minima 
Python :: Group the values for each key in the RDD into a single sequence. 
Python :: assign multiple vabies in one line 
Python :: copy constructor python 
Python :: devu and friendship testing codechef solution 
Python :: discord.py find channel by id 
Python :: print(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) print(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) 
Python :: how to check if a function false python 
Python :: discord.File(fp=image_binary,filename=name) discord py 
Python :: AI Challenge 
Python :: convert to pdf fresh little library that outputs our notebook in a nice LaTex format without installing/doing anything else. 
Python :: del no of elements in lis 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =