I have an array of 20 ndarray objects in the shape (640, 480) which corresponds to image frames that I am working with.
I'd like to "partition" each of these ndarray objects into 8 smaller "chunks", each with the shape (160, 240) but seem to be not getting the proper results. I'm currently trying this:
frames = [np.zeros((640, 480)) for _ in range(20)] # 20 "image frames"
res = [frame.reshape((240, 160, 8)) for frame in frames]
And what res ends up equaling is an array of 20 ndarray objects with the shape (160, 240, 8), whereas instead I would like res to equal an array of subarrays, where each subarray contains 8 ndarray objects of shape (160, 240).