The question is how to rotate image using OpenCV and keep original dimensions. Currently using this function:
def rotateImage(image, angle):
(h, w) = image.shape[:2]
center = (w / 2, h / 2)
M = cv2.getRotationMatrix2D(center,angle,1.0)
rotated_image = cv2.warpAffine(image, M, (w,h))
return rotated_image
Additionally what kind of algorithm utilised in warpAffine (Bicubic?)
Create new square image with dimension = diagonal of your initial image.
Draw initial image into the center of new image.
Rotate new image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With