You can simply use the imutils package to do the rotation. it has two methods
- rotate: Rotate the image at specified angle. however the drawback is image might get cropped if it is not a square image.
- Rotate_bound: it overcomes the problem happened with rotate. It adjusts the size of the image accordingly while rotating the image.
more info you can get on this blog:
https://www.pyimagesearch.com/2017/01/02/rotate-images-correctly-with-opencv-and-python/