Skip to content

Commit ecfd3a0

Browse files
authored
add cn doc for RandomPerspective and perspective (#5353)
1 parent 8f27bb5 commit ecfd3a0

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. _cn_api_vision_transforms_RandomPerspective:
2+
3+
RandomPerspective
4+
-------------------------------
5+
6+
.. py:class:: paddle.vision.transforms.RandomPerspective(prob=0.5, distortion_scale=0.5, interpolation='nearest', fill=0, keys=None)
7+
8+
按照一定概率对图片进行透视变换。
9+
10+
参数
11+
::::::::::::
12+
- **prob** (float,可选) - 进行透视变换的概率,范围为 [0, 1] 。默认值: 0.5 。
13+
- **distortion_scale** (float,可选) - 图片失真程度的大小,范围为 [0, 1] 。默认值: 0.5 。
14+
- **interpolation** (str,可选) - 插值的方法。
15+
如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。
16+
当使用 ``pil`` 作为后端时, 支持的插值方法如下:
17+
- "nearest": Image.NEAREST
18+
- "bilinear": Image.BILINEAR
19+
- "bicubic": Image.BICUBIC
20+
当使用 ``cv2`` 作为后端时, 支持的插值方法如下:
21+
- "nearest": cv2.INTER_NEAREST
22+
- "bilinear": cv2.INTER_LINEAR
23+
- "bicubic": cv2.INTER_CUBIC
24+
- **fill** (int|list|tuple,可选) - 对图像扩展时填充的值。默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。
25+
- **keys** (list[str]|tuple[str],可选) - 与 ``BaseTransform`` 定义一致。默认值: None 。
26+
27+
形状
28+
::::::::::::
29+
30+
- img (PIL.Image|np.ndarray|Paddle.Tensor) - 输入的图像数据,数据格式为 [H, W, C] 。
31+
- output (PIL.Image|np.ndarray|Paddle.Tensor) - 返回随机透视变换后的图像数据。
32+
33+
返回
34+
::::::::::::
35+
36+
计算 ``RandomPerspective`` 的可调用对象。
37+
38+
39+
代码示例
40+
::::::::::::
41+
42+
COPY-FROM: paddle.vision.transforms.RandomPerspective
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _cn_api_vision_transforms_perspective:
2+
3+
perspective
4+
-------------------------------
5+
6+
.. py:function:: paddle.vision.transforms.perspective(img, startpoints, endpoints, interpolation='nearest', fill=0)
7+
8+
对图像进行透视变换。
9+
10+
参数
11+
::::::::::::
12+
- **img** (PIL.Image|numpy.ndarray|paddle.Tensor) - 输入图像。
13+
- **startpoints** (list(list(float))) - 在原图上的四个角(左上、右上、右下、左下)的坐标。
14+
- **endpoints** (list(list(float))) - 在变换后的图上的四个角(左上、右上、右下、左下)的坐标。
15+
- **interpolation** (str,可选) - 插值的方法。
16+
如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。
17+
当使用 ``pil`` 作为后端时, 支持的插值方法如下:
18+
- "nearest": Image.NEAREST
19+
- "bilinear": Image.BILINEAR
20+
- "bicubic": Image.BICUBIC
21+
当使用 ``cv2`` 作为后端时, 支持的插值方法如下:
22+
- "nearest": cv2.INTER_NEAREST
23+
- "bilinear": cv2.INTER_LINEAR
24+
- "bicubic": cv2.INTER_CUBIC
25+
- **fill** (int|list|tuple,可选) - 对图像扩展时填充的像素值,默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。
26+
27+
返回
28+
::::::::::::
29+
30+
``PIL.Image 或 numpy ndarray 或 paddle.Tensor`` ,透视变换后的图像。
31+
32+
代码示例
33+
::::::::::::
34+
35+
COPY-FROM: paddle.vision.transforms.perspective

0 commit comments

Comments
 (0)