I am trying to extract patches of fixed size centered at some given position (x,y). The code is given below-
for i,j in zip(indices[0],indices[1]): patch
Using scikit-learn:
from sklearn.feature_extraction.image import extract_patches all_patches = extract_patches(x, patch_size) upper_left = indices - patch_size // 2 patches = all_patches[upper_left[0], upper_left[1]]
A similar function can be found in scikit-image: view_as_windows.