public Pixel[][] patches(int patchWidth, int patchHeight) {
        Pixel[][] patches = new Pixel[(height - patchHeight) * (width - patchWidth)][];
        int k = 0;
        for (int row = 0; row < height - patchHeight; row++) {
            for (int col = 0; col < width - patchWidth; col++) {
                patches[k] = patch(col, row, patchWidth, patchHeight);
            }
        }
        return patches;
    }
public Pixel [ ] [ ] patches ( int patchWidth , int patchHeight ) { Pixel [ ] [ ] patches = new Pixel [ ( height - patchHeight ) * ( width - patchWidth ) ] [ ] ; int k = 0 ; for ( int row = 0 ; row < height - patchHeight ; row ++ ) { for ( int col = 0 ; col < width - patchWidth ; col ++ ) { patches [ k ] = patch ( col , row , patchWidth , patchHeight ) ; } } return patches ; }
Returns all the patches of a given size in the image, assuming pixel
alignment (no subpixel extraction).
<p>
The patches are returned as an array of of pixel matrices arrays.