原视频 代码 import cv2# 打开视频文件 video = cv2.VideoCapture('inference/video/lianzhang.mp4')# 获取原视频的宽度和高度 width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))# 创建视频编写器并设置输出视频参数 fourcc = cv2.VideoWriter_fourcc(*'mp4v') output = cv2.VideoWriter('inference/video/output.mp4', fourcc, 30.0, (height, width))while video.isOpened():ret, frame = video.read()if not ret:break# 对每一帧图像进行逆时针旋转90度,正时针是cv2.ROTATE_90_CLOCKWISErotated_frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)# 写入旋转后的帧到输出视频文件output.write(rotated_frame)cv2.imshow('Rotated Video', rotated_frame)# 按下 'q' 键退出循环if cv2.waitKey(10) & 0xFF == ord('q'):break# 释放资源 video.release() output.release() cv2.destroyAllWindows() 旋转后