Crops an image given coordinates of cropping box. :param image: 3-dimensional image. :param x1: Left x coordinate. :param x2: Right x coordinate. :param y1: Bottom y coordinate. :param y2: Top y coordinate. :return: Image cropped using coordinates (x1, x2, y1, y2).
(image: np.ndarray, x1: int, x2: int, y1: int, y2: int)
| 19 | |
| 20 | |
| 21 | def crop(image: np.ndarray, x1: int, x2: int, y1: int, y2: int) -> np.ndarray: |
| 22 | # language=rst |
| 23 | """ |
| 24 | Crops an image given coordinates of cropping box. |
| 25 | |
| 26 | :param image: 3-dimensional image. |
| 27 | :param x1: Left x coordinate. |
| 28 | :param x2: Right x coordinate. |
| 29 | :param y1: Bottom y coordinate. |
| 30 | :param y2: Top y coordinate. |
| 31 | :return: Image cropped using coordinates (x1, x2, y1, y2). |
| 32 | """ |
| 33 | return image[x1:x2, y1:y2, :] |
| 34 | |
| 35 | |
| 36 | def binary_image(image: np.ndarray) -> np.ndarray: |