Instead of storing index in separate list use range in python to get patches
patchwidth = imagewidth//cropidx
patchheight = imageheight//cropidx
patches=[]
for row in range(0,imageheight, patchheight):
for col in range(0,imagewidth, patchwidth):
patches.append(image[row:row+patchheight, col:col+pathwidth])