MCPcopy Create free account
hub / github.com/HYUNJS/SGT / apply_image

Method apply_image

projects/Datasets/Transforms/transform.py:106–117  ·  view source on GitHub ↗

Apply AffineTransform for the image(s). Args: img (ndarray): of shape HxW, HxWxC, or NxHxWxC. The array can be of type uint8 in range [0, 255], or floating point in range [0, 1] or [0, 255]. Returns: ndarray: the image

(self, img: np.ndarray)

Source from the content-addressed store, hash-verified

104 self._set_attributes(locals())
105
106 def apply_image(self, img: np.ndarray) -> np.ndarray:
107 """
108 Apply AffineTransform for the image(s).
109
110 Args:
111 img (ndarray): of shape HxW, HxWxC, or NxHxWxC. The array can be
112 of type uint8 in range [0, 255], or floating point in range
113 [0, 1] or [0, 255].
114 Returns:
115 ndarray: the image(s) after applying affine transform.
116 """
117 return cv2.warpAffine(img, self.affine, self.output_size, flags=cv2.INTER_LINEAR, borderValue=self.border_value)
118
119 def apply_coords(self, coords: np.ndarray) -> np.ndarray:
120 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected