1234567891011121314151617181920 |
- import cv2 as cv
- import numpy as np
- def rot_img_2(img: "np.ndarray") -> "list[np.ndarray]":
- if img.shape[0] > img.shape[1]: # 0: height, 1: width
- return [np.rot90(img), np.rot90(img, 3)]
- return [img, np.rot90(img, 2)]
- def main():
- img = cv.imread("img/1.jpg")
- rot = rot_img_2(img)
- cv.imshow("1", rot[0])
- cv.imshow("2", rot[1])
- cv.waitKey(0)
- if __name__ == '__main__':
- main()
|