MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / apply_image

Method apply_image

PATH/core/data/transforms/seg_aug_dev.py:177–191  ·  view source on GitHub ↗

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

(self, img: np.ndarray)

Source from the content-addressed store, hash-verified

175 self._set_attributes(locals())
176
177 def apply_image(self, img: np.ndarray) -> np.ndarray:
178 """
179 Crop the image(s).
180
181 Args:
182 img (ndarray): of shape NxHxWxC, or HxWxC or HxW. The array can be
183 of type uint8 in range [0, 255], or floating point in range
184 [0, 1] or [0, 255].
185 Returns:
186 ndarray: cropped image(s).
187 """
188 if len(img.shape) <= 3:
189 return img[self.y0 : self.y0 + self.h, self.x0 : self.x0 + self.w]
190 else:
191 return img[..., self.y0 : self.y0 + self.h, self.x0 : self.x0 + self.w, :]
192
193 def apply_coords(self, coords: np.ndarray) -> np.ndarray:
194 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected