sophon_ai_project/docs/sail_api/3.填充属性.md
2025-10-17 16:30:24 +08:00

2.4 KiB
Raw Blame History

填充属性

PaddingAtrr中存储了数据padding的各项属性可通过配置PaddingAtrr进行数据填充

__init__

初始化 PaddingAtrr

接口形式:

def __init__(self)
def __init__(self, stx: int, sty: int, width: int, height: int, r: int, g: int, b: int)

参数说明:

  • stx: int

原图像相对于目标图像在x方向上的偏移量

  • sty: int

原图像相对于目标图像在y方向上的偏移量

  • width: int

在 padding 的同时可对原图像进行 resizewidth 为原图像 resize 后的宽,若不进行 resize则 width 为原图像的宽

  • height: int

在 padding 的同时对原图像进行 resizeheight 为原图像 resize 后的高,若不进行 resize则 height 为原图像的高

  • r: int

padding 时在 R 通道上填充的像素值

  • g: int

padding 时在 G 通道上填充的像素值

  • b: int

padding 时在B通道上填充的像素值

set_stx

设置原图像相对于目标图像在 x 方向上的偏移量

接口形式

def set_stx(self, stx: int) -> None

参数说明

  • stx: int

原图像相对于目标图像在x方向上的偏移量

set_sty

设置原图像相对于目标图像在y方向上的偏移量

接口形式:

def set_sty(self, sty: int) -> None

参数说明:

  • sty: int

原图像相对于目标图像在y方向上的偏移量

set_w

设置原图像resize后的width

接口形式:

def set_w(self, width: int) -> None

参数说明:

  • width: int

在padding的同时可对原图像进行resizewidth为原图像resize后的宽若不进行resize则width为原图像的宽

set_h

设置原图像resize后的height

接口形式:

def set_h(self, height: int) -> None

参数说明:

  • height: int

在padding的同时可对原图像进行resizeheight为原图像resize后的高若不进行resize则height为原图像的高

set_r

设置R通道上的padding值

接口形式:

def set_r(self, r: int) -> None

参数说明

  • r: int

R通道上的padding值

set_g

设置G通道上的padding值

接口形式:

def set_g(self, g: int) -> None

参数说明

  • g: int

G通道上的padding值

set_b

设置B通道上的padding值

接口形式:

def set_b(self, b: int) -> None

参数说明

  • b: int

B通道上的padding值