Args: x0, y0: number of padded pixels on the left and top x1, y1: number of padded pixels on the right and bottom orig_w, orig_h: optional, original width and height. Needed to make this transform invertible. pad_value: the pad
(
self,
x0: int,
y0: int,
x1: int,
y1: int,
orig_w: Optional[int] = None,
orig_h: Optional[int] = None,
pad_value: float = 0,
seg_pad_value: int = 0,
)
| 261 | |
| 262 | class PadTransform(Transform): |
| 263 | def __init__( |
| 264 | self, |
| 265 | x0: int, |
| 266 | y0: int, |
| 267 | x1: int, |
| 268 | y1: int, |
| 269 | orig_w: Optional[int] = None, |
| 270 | orig_h: Optional[int] = None, |
| 271 | pad_value: float = 0, |
| 272 | seg_pad_value: int = 0, |
| 273 | ): |
| 274 | """ |
| 275 | Args: |
| 276 | x0, y0: number of padded pixels on the left and top |
| 277 | x1, y1: number of padded pixels on the right and bottom |
| 278 | orig_w, orig_h: optional, original width and height. |
| 279 | Needed to make this transform invertible. |
| 280 | pad_value: the padding value to the image |
| 281 | seg_pad_value: the padding value to the segmentation mask |
| 282 | """ |
| 283 | super().__init__() |
| 284 | self._set_attributes(locals()) |
| 285 | |
| 286 | def apply_image(self, img): |
| 287 | if img.ndim == 3: |
nothing calls this directly
no test coverage detected