def get_patches(image, target_size=64, step=None, preprocess=False):
    """
    Crops image into square patches
    :param image_path: path to original image
    :param target_size: side length of patch
    :param step: Steps between patches. If None, step=target_size
    :param preprocess:
    :return: List of patches (2d-numpy arrays)
    """
    height, width = image.shape

    if step is None:
        step = target_size

    patches = []
    for y in range(0, height-target_size+1, step):
        for x in range(0, width-target_size+1, step):
            patch = image[y:y+target_size, x:x + target_size]
            patches.append(patch)
    #
    # for y in range(target_size, height+1, step):
    #     for x in range(target_size, width+1, step):
    #         patch = image[y - target_size:y, x - target_size:x]
    #         patches.append(patch)
    return patches