Пример #1
0
def crop_resize(img, meta, img_shape=(64, 64)):
    """
    Crop center and resize.
    :param img: image to be cropped and resized.
    """
    if img.shape[0] < img.shape[1]:
        img = img.T
    # we crop image from center
    short_edge = min(img.shape[:2])
    yy = int((img.shape[0] - short_edge) / 2)
    xx = int((img.shape[1] - short_edge) / 2)
    crop_img = img[yy:yy + short_edge, xx:xx + short_edge]
    img = crop_img
    img = sk_imresize(img, img_shape)
    return img
Пример #2
0
def crop_resize(img,meta,img_shape=(64,64)):
    """
    Crop center and resize.
    :param img: image to be cropped and resized.
    """
    if img.shape[0] < img.shape[1]:
        img = img.T
    # we crop image from center
    short_edge = min(img.shape[:2])
    yy = int((img.shape[0] - short_edge) / 2)
    xx = int((img.shape[1] - short_edge) / 2)
    crop_img = img[yy: yy + short_edge, xx: xx + short_edge]
    img = crop_img
    img = sk_imresize(img, img_shape)
    return img
Пример #3
0
def imresize(img, meta, img_shape=(64, 64)):
    return sk_imresize(img, img_shape)
Пример #4
0
def imresize(img,meta,img_shape=(64,64)):
    return sk_imresize(img,img_shape)