@@ -269,18 +269,18 @@ def center_crop(img, output_size):
269
269
PIL.Image or np.array: Cropped image.
270
270
271
271
Examples:
272
- .. code-block:: python
272
+ .. code-block:: python
273
273
274
- import numpy as np
275
- from PIL import Image
276
- from paddle.vision.transforms import functional as F
274
+ import numpy as np
275
+ from PIL import Image
276
+ from paddle.vision.transforms import functional as F
277
277
278
- fake_img = (np.random.rand(256, 300, 3) * 255.).astype('uint8')
278
+ fake_img = (np.random.rand(256, 300, 3) * 255.).astype('uint8')
279
279
280
- fake_img = Image.fromarray(fake_img)
280
+ fake_img = Image.fromarray(fake_img)
281
281
282
- cropped_img = F.center_crop(fake_img, (150, 100))
283
- print(cropped_img.size)
282
+ cropped_img = F.center_crop(fake_img, (150, 100))
283
+ print(cropped_img.size)
284
284
"""
285
285
if not (
286
286
_is_pil_image (img ) or _is_numpy_image (img ) or _is_tensor_image (img )
@@ -764,7 +764,7 @@ def rotate(
764
764
Origin is the upper left corner.
765
765
Default is the center of the image.
766
766
fill (3-list|3-tuple or int): RGB pixel fill value for area outside the rotated image.
767
- If int, it is used for all channels respectively.
767
+ If int, it is used for all channels respectively. Default value is 0.
768
768
769
769
770
770
Returns:
@@ -919,7 +919,8 @@ def to_grayscale(img, num_output_channels=1):
919
919
920
920
Args:
921
921
img (PIL.Image|np.array): Image to be converted to grayscale.
922
-
922
+ num_output_channels (int, optional): The number of channels for the output
923
+ image. Single channel. Default: 1.
923
924
Returns:
924
925
PIL.Image or np.array: Grayscale version of the image.
925
926
if num_output_channels = 1 : returned image is single channel
0 commit comments