1 import cv2
2
3 img_path = r"E:\tmp\tmp.jpg"
4 image = cv2.imread(img_path)
5 cv2.imshow("image", image)
6 cv2.waitKey(5000)
![](https://img2020.cnblogs.com/blog/758183/202103/758183-20210325131142260-1907564871.jpg)
镜像/顺时针旋转180度
1 image1 = cv2.flip(image, -1)
2 cv2.imshow("image", image1)
3 cv2.waitKey(5000)
![](https://img2020.cnblogs.com/blog/758183/202103/758183-20210325131631167-581432777.jpg)
转置
1 image2 = cv2.transpose(image)
2 cv2.imshow("0", image2)
3 cv2.waitKey(5000)
![](https://img2020.cnblogs.com/blog/758183/202103/758183-20210325131924580-1409770847.jpg)
顺时针旋转90度
image3 = cv2.transpose(image)
image3 = cv2.flip(image3, 1)
cv2.imshow("1", image3)
cv2.waitKey(5000)
![](https://img2020.cnblogs.com/blog/758183/202103/758183-20210325132630323-1153468268.jpg)
顺时针旋转270度
1 image4 = cv2.transpose(image)
2 image4 = cv2.flip(image4, 0)
3 cv2.imshow("1", image4)
4 cv2.waitKey(5000)
![](https://img2020.cnblogs.com/blog/758183/202103/758183-20210325132835805-214029312.jpg)