Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cn doc for RandomPerspective and perspective #5353

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/api/paddle/vision/transforms/RandomPerspective_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _cn_api_vision_transforms_RandomPerspective:

RandomPerspective
-------------------------------

.. py:class:: paddle.vision.transforms.RandomPerspective(prob=0.5, distortion_scale=0.5, interpolation='nearest', fill=0, keys=None)

按照一定概率对图片进行透视变换。

参数
::::::::::::
- **prob** (float,可选) - 进行透视变换的概率,范围为 [0, 1] 。默认值: 0.5 。
- **distortion_scale** (float,可选) - 图片失真程度的大小,范围为 [0, 1] 。默认值: 0.5 。
- **interpolation** (str,可选) - 插值的方法。
如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。
当使用 ``pil`` 作为后端时, 支持的插值方法如下:
- "nearest": Image.NEAREST
- "bilinear": Image.BILINEAR
- "bicubic": Image.BICUBIC
当使用 ``cv2`` 作为后端时, 支持的插值方法如下:
- "nearest": cv2.INTER_NEAREST
- "bilinear": cv2.INTER_LINEAR
- "bicubic": cv2.INTER_CUBIC
- **fill** (int|list|tuple,可选) - 对图像扩展时填充的值。默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。
- **keys** (list[str]|tuple[str],可选) - 与 ``BaseTransform`` 定义一致。默认值: None 。

形状
::::::::::::

- img (PIL.Image|np.ndarray|Paddle.Tensor) - 输入的图像数据,数据格式为 [H, W, C] 。
- output (PIL.Image|np.ndarray|Paddle.Tensor) - 返回随机透视变换后的图像数据。

返回
::::::::::::

计算 ``RandomPerspective`` 的可调用对象。


代码示例
::::::::::::

COPY-FROM: paddle.vision.transforms.RandomPerspective
35 changes: 35 additions & 0 deletions docs/api/paddle/vision/transforms/perspective_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. _cn_api_vision_transforms_perspective:

perspective
-------------------------------

.. py:function:: paddle.vision.transforms.perspective(img, startpoints, endpoints, interpolation='nearest', fill=0)

对图像进行透视变换。

参数
::::::::::::
- **img** (PIL.Image|numpy.ndarray|paddle.Tensor) - 输入图像。
- **startpoints** (list(list(float))) - 在原图上的四个角(左上、右上、右下、左下)的坐标。
- **endpoints** (list(list(float))) - 在变换后的图上的四个角(左上、右上、右下、左下)的坐标。
- **interpolation** (str,可选) - 插值的方法。
如果这个参数没有设定或者输入图像为单通道,则该参数会根据使用的后端,被设置为 ``PIL.Image.NEAREST`` 或者 ``cv2.INTER_NEAREST`` 。
当使用 ``pil`` 作为后端时, 支持的插值方法如下:
- "nearest": Image.NEAREST
- "bilinear": Image.BILINEAR
- "bicubic": Image.BICUBIC
当使用 ``cv2`` 作为后端时, 支持的插值方法如下:
- "nearest": cv2.INTER_NEAREST
- "bilinear": cv2.INTER_LINEAR
- "bicubic": cv2.INTER_CUBIC
- **fill** (int|list|tuple,可选) - 对图像扩展时填充的像素值,默认值: 0 ,如果只设定一个数字则所有通道上像素值均为该值。

返回
::::::::::::

``PIL.Image 或 numpy ndarray 或 paddle.Tensor`` ,透视变换后的图像。

代码示例
::::::::::::

COPY-FROM: paddle.vision.transforms.perspective