MCPcopy Create free account
hub / github.com/PyImageSearch/imutils / rotate

Function rotate

imutils/convenience.py:25–39  ·  view source on GitHub ↗
(image, angle, center=None, scale=1.0)

Source from the content-addressed store, hash-verified

23 return shifted
24
25def rotate(image, angle, center=None, scale=1.0):
26 # grab the dimensions of the image
27 (h, w) = image.shape[:2]
28
29 # if the center is None, initialize it as the center of
30 # the image
31 if center is None:
32 center = (w // 2, h // 2)
33
34 # perform the rotation
35 M = cv2.getRotationMatrix2D(center, angle, scale)
36 rotated = cv2.warpAffine(image, M, (w, h))
37
38 # return the rotated image
39 return rotated
40
41def rotate_bound(image, angle):
42 # grab the dimensions of the image and then determine the

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…