Skip to content

Instantly share code, notes, and snippets.

@Praveen76
Created April 15, 2022 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Praveen76/c68ec6aa86369989b1ca08eeb261b626 to your computer and use it in GitHub Desktop.
Save Praveen76/c68ec6aa86369989b1ca08eeb261b626 to your computer and use it in GitHub Desktop.
def rotation(img,angle,rotpoint=None):
(height,width)=img.shape[:2]
if rotpoint is None:
rotpoint=(height//2,width//2)
rotmat=cv.getRotationMatrix2D(rotpoint,angle,1.0)
dimension=(width,height)
return cv.warpAffine(img,rotmat,dimension)
rotated=rotation(img,45)
cv.imshow('rotated',rotated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment