dovahcrow / patchify.py

A library that helps you split image into small, overlappable patches, and merge patches into original image.
MIT License
211 stars 25 forks source link

For 3d image patch, when passing more than 3 channels the documentation for 'patch size' is incorrect #20

Open vaneezam opened 2 years ago

vaneezam commented 2 years ago

I wanted to pass a 12 channel/band image with shape [256,256,12], where 256, 256 are size of the image and 12 are the channel/band to create patches of dimension 128,128,12.

Inorder to patchify, the documentation mentions to pass the patch size as : 128,128,12 patches = patchify(image, (2,2,3), step=1) # patch shape [2,2,3]

However, this only works in case of 3 channel/band data and not for more than 3 channel/band data. I have tried and tested this senario. For more than 3 channel/band data as in this case, the image should be passed with dimensions: [12, 256, 256] and the patch size dimensions should be [12,128,128] instead of [128,128,12].

image Please review this to the documentation. Thanks.