Crops the given PIL Image on the long edge. Args: size (sequence or int): Desired output size of the crop. If size is an int instead of sequence like (h, w), a square crop (size, size) is made.
| 2 | |
| 3 | |
| 4 | class CenterCropLongEdge(object): |
| 5 | """Crops the given PIL Image on the long edge. |
| 6 | Args: |
| 7 | size (sequence or int): Desired output size of the crop. If size is an |
| 8 | int instead of sequence like (h, w), a square crop (size, size) is |
| 9 | made. |
| 10 | """ |
| 11 | |
| 12 | def __call__(self, img): |
| 13 | """ |
| 14 | Args: |
| 15 | img (PIL Image): Image to be cropped. |
| 16 | Returns: |
| 17 | PIL Image: Cropped image. |
| 18 | """ |
| 19 | return TF.center_crop(img, min(img.size)) |
| 20 | |
| 21 | def __repr__(self): |
| 22 | return self.__class__.__name__ |
| 23 | |
| 24 |