How to Rotate an Image in OpenCV
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
import cv2
img=cv2.imread("D://opencvapp//mountain-girl.jpg")
img=cv2.resize(img,(500,500))
#img=cv2.rotate(img,cv2.cv2.ROTATE_90_CLOCKWISE)
#img=cv2.rotate(img,cv2.cv2.ROTATE_90_COUNTERCLOCKWISE)
img=cv2.rotate(img,cv2.cv2.ROTATE_180)
cv2.imwrite('newmountain.jpg',img)
cv2.imshow('Mountain Image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

