parameters: (img, size)
return_statement: return resized_img.astype("uint8")
docstring: crop center and resize
docstring_summary: crop center and resize
docstring_tokens: crop center and resize
function: def crop_resize(img, size):
     """crop center and resize"""
     if img.shape[0] < img.shape[1]:
         img = img.T
     # we crop image from center
     short_egde = min(img.shape[:2])
     yy = int((img.shape[0] - short_egde) / 2)
     xx = int((img.shape[1] - short_egde) / 2)
     crop_img = img[yy : yy + short_egde, xx : xx + short_egde]
     # resize to 64, 64
     resized_img = transform.resize(crop_img, (size, size))
     resized_img *= 255
     return resized_img.astype("uint8")
function_tokens: def crop_resize ( img , size ) : if img . shape [ 0 ] < img . shape [ 1 ] : img = img . T # we crop image from center short_egde = min ( img . shape [ : 2 ] ) yy = int ( ( img . shape [ 0 ] - short_egde ) / 2 ) xx = int ( ( img . shape [ 1 ] - short_egde ) / 2 ) crop_img = img [ yy : yy + short_egde , xx : xx + short_egde ] # resize to 64, 64 resized_img = transform . resize ( crop_img , ( size , size ) ) resized_img *= 255 return resized_img . astype ( "uint8" )