def __call__(self, img):
        """
        Args:
            img (PIL.Image): Image to be cropped.
        Returns:
            PIL.Image: Cropped image.
        """
        w, h = img.size
        th, tw = self.size
        x1 = int(round((w - tw) / 2.))
        y1 = int(round((h - th) / 2.))
        return img.crop((x1, y1, x1 + tw, y1 + th))
def __call__ ( self , img ) : w , h = img . size th , tw = self . size x1 = int ( round ( ( w - tw ) / 2. ) ) y1 = int ( round ( ( h - th ) / 2. ) ) return img . crop ( ( x1 , y1 , x1 + tw , y1 + th ) )
Args:
            img (PIL.Image): Image to be cropped.
        Returns:
            PIL.Image: Cropped image.