MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_rotation

Function get_rotation

digital_image_processing/rotation/rotation.py:8–21  ·  view source on GitHub ↗

Get image rotation :param img: np.ndarray :param pt1: 3x2 list :param pt2: 3x2 list :param rows: columns image shape :param cols: rows image shape :return: np.ndarray

(
    img: np.ndarray, pt1: np.ndarray, pt2: np.ndarray, rows: int, cols: int
)

Source from the content-addressed store, hash-verified

6
7
8def get_rotation(
9 img: np.ndarray, pt1: np.ndarray, pt2: np.ndarray, rows: int, cols: int
10) -> np.ndarray:
11 """
12 Get image rotation
13 :param img: np.ndarray
14 :param pt1: 3x2 list
15 :param pt2: 3x2 list
16 :param rows: columns image shape
17 :param cols: rows image shape
18 :return: np.ndarray
19 """
20 matrix = cv2.getAffineTransform(pt1, pt2)
21 return cv2.warpAffine(img, matrix, (rows, cols))
22
23
24if __name__ == "__main__":

Callers 1

rotation.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected