Apply crop transform on coordinates. Args: coords (ndarray): floating point array of shape Nx2. Each row is (x, y). Returns: ndarray: cropped coordinates.
(self, coords: np.ndarray)
| 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 | """ |
| 195 | Apply crop transform on coordinates. |
| 196 | |
| 197 | Args: |
| 198 | coords (ndarray): floating point array of shape Nx2. Each row is |
| 199 | (x, y). |
| 200 | Returns: |
| 201 | ndarray: cropped coordinates. |
| 202 | """ |
| 203 | coords[:, 0] -= self.x0 |
| 204 | coords[:, 1] -= self.y0 |
| 205 | return coords |
| 206 | |
| 207 | def apply_polygons(self, polygons: list) -> list: |
| 208 | """ |