This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def transform_coordinates(x: np.float32, y: np.float32, matrix: np.ndarray) -> np.ndarray: | |
| """ | |
| Calculate coordinates transformation. | |
| :param x: x coordinate. | |
| :param y: y coordinate. | |
| :param matrix: transformation matrix. Can be obtained from cv2.findHomography(). | |
| :return: transformed coordinates. | |
| """ | |
| return cv2.perspectiveTransform(np.array([[[x, y]]], dtype=np.float32), matrix).reshape(2) |