nvidia.dali.fn.experimental.warp_perspective#

nvidia.dali.fn.experimental.warp_perspective(__input, __matrix_gpu=None, /, *, border_mode='constant', bytes_per_sample_hint=[0], fill_value=[], interp_type=DALIInterpType.INTERP_LINEAR, inverse_map=True, matrix=[], pixel_origin='corner', preserve=False, size=[], device=None, name=None)#

对图像执行透视变换。

支持的后端
  • ‘gpu’

参数:
  • __input (TensorList of uint8, uint16, int16 or float ('HW', 'HWC', 'FHWC', 'CHW', 'FCHW')) – 输入数据。 必须是 HWC 或 CHW 布局的图像,或这些图像的序列。

  • __matrix_gpu (1D TensorList of float, optional) – 变换矩阵数据。 应用于传递 GPU 数据。 对于 CPU 数据,应使用 matrix 参数。

关键字参数:
  • border_mode (str, optional, default = ‘constant’) – 访问输入图像外部元素时要使用的边框模式。 支持的值为:“constant”、“replicate”、“reflect”、“reflect_101”、“wrap”。

  • bytes_per_sample_hint (int or list of int, optional, default = [0]) –

    每个样本的输出大小提示(以字节为单位)。

    如果指定,则将预先分配驻留在 GPU 或分页锁定主机内存中的运算符输出,以容纳此大小的样本批次。

  • fill_value (float or list of float, optional, default = []) – 当选择“constant” border_mode 时,用于填充源图像外部区域的值。

  • interp_type (nvidia.dali.types.DALIInterpType, optional, default = DALIInterpType.INTERP_LINEAR) – 使用的插值类型。

  • inverse_map (bool, optional, default = True) – 如果设置为 true(默认值),则矩阵被解释为目标到源坐标映射。 否则,它被解释为源到目标坐标映射。

  • matrix (float or list of float or TensorList of float, optional, default = []) –

    目标到源坐标的透视变换映射。

    如果 inverse_map 参数设置为 false,则矩阵被解释为源到目标坐标的映射。

    它等效于 OpenCV 的 warpPerspective 操作,其中 inverse_map 参数类似于 WARP_INVERSE_MAP 标志。

    注意

    除了此参数之外,运算符还可以接受第二个位置输入,在这种情况下,矩阵可以放置在 GPU 上。

    支持 per-frame 输入。

  • pixel_origin (str, optional, default = ‘corner’) –

    像素原点。 可能的值:“corner”、“center”。

    确定 (0, 0) 坐标的含义 - “corner” 将原点放置在左上角像素的左上角(如 OpenGL 中); “center” 将 (0, 0) 放置在左上角像素的中心(如 OpenCV 中)。)

  • preserve (bool, optional, default = False) – 即使运算符的输出未使用,也阻止将其从图中删除。

  • size (float or list of float or TensorList of float, optional, default = []) –

    输出大小,以像素/点为单位。

    应排除通道维度(例如,对于 RGB 图像,指定 (480,640),而不是 (480,640,3)