I have an im image, which is the array given by imread . Say for example
im = np.array([[1,2,3,4], [2,3,4,5], [3,4,5,6], [4,5,6,7]]
I have another array of (n,4) windows , where each line defines the image patch as (x, y, w, h) . For instance.
windows = np.array([[0,0,2,2], [1,1,2,2]]
I would like to extract all these fixes from im as sub-arrays without scrolling. My current looping solution is something like:
for x, y, w, h in windows: patch = im[y:(y+h),x:(x+w)]
But I need a good array-based operation to get all of them, if possible.
Thanks.