(img)
return img
Crop center and resize.

    :param img: image to be cropped and resized.
Crop center and resize.
Crop center and resize .
def crop_resize(img):
    """
    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 = imresize(img, img_shape)
    return img
def crop_resize ( img ) : 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 = imresize ( img , img_shape ) return img