run_projector2.py
def crop (img, size):
    """crop img central and resize to size"""
    w, h = img.size   # Get dimensions
    mx = min(w, h)

    left = (w - mx)/2
    top = (h - mx)/2
    right = (w + mx)/2
    bottom = (h + mx)/2

    img_crop = img.crop((left, top, right, bottom))
    return img_crop.resize(size, resample=Image.BILINEAR)
crop img central and resize to size
crop img central and resize to size
crop img central and resize to size
def crop (img, size):
    w, h = img.size   
    mx = min(w, h)
    left = (w - mx)/2
    top = (h - mx)/2
    right = (w + mx)/2
    bottom = (h + mx)/2
    img_crop = img.crop((left, top, right, bottom))
    return img_crop.resize(size, resample=Image.BILINEAR)
def crop ( img , size ) : w , h = img . size mx = min ( w , h ) left = ( w - mx ) / 2 top = ( h - mx ) / 2 right = ( w + mx ) / 2 bottom = ( h + mx ) / 2 img_crop = img . crop ( ( left , top , right , bottom ) ) return img_crop . resize ( size , resample = Image . BILINEAR )
crop img central and resize to size
crop img central and resize to size
"""crop img central and resize to size""" # Get dimensions
img
size