python opencv图片旋转任意角度
import cv2 # Load the image img = cv2.imread("20230222100736979.jpg") # Get the image dimensions height, width = img.shape[:2] # Set the rotation angle angle = 25 # Calculate the rotation matrix rotation_matrix = cv2.getRotationMatrix2D((width/2, height/2), angle, 1) # Apply the rotation matrix to the image rotated_img = cv2.warpAffine(img, rotation_matrix, (width, height)) # Display the rotated image cv2.imshow("Rotated Image", rotated_img) cv2.waitKey(0) cv2.destroyAllWindows()
####################
标签:matrix,img,python,rotated,image,cv2,opencv,rotation,任意 From: https://www.cnblogs.com/herd/p/17297700.html