MCPcopy Create free account
hub / github.com/BindsNET/bindsnet / crop

Function crop

bindsnet/datasets/preprocess.py:21–33  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

19
20
21def 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
36def binary_image(image: np.ndarray) -> np.ndarray:

Callers 1

preprocessMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected