MCPcopy Index your code
hub / github.com/alievk/avatarify-python / crop

Function crop

afy/utils.py:117–129  ·  view source on GitHub ↗
(img, p=0.7, offset_x=0, offset_y=0)

Source from the content-addressed store, hash-verified

115
116
117def crop(img, p=0.7, offset_x=0, offset_y=0):
118 h, w = img.shape[:2]
119 x = int(min(w, h) * p)
120 l = (w - x) // 2
121 r = w - l
122 u = (h - x) // 2
123 d = h - u
124 l += offset_x
125 r += offset_x
126 u += offset_y
127 d += offset_y
128
129 return img[u:d, l:r], (l,r,u,d,w,h)
130
131
132def pad_img(img, target_size, default_pad=0):

Callers 1

cam_fomm.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected