MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / draw_facepose

Function draw_facepose

utils/general_util.py:164–179  ·  view source on GitHub ↗
(image, lmks,eps=1)

Source from the content-addressed store, hash-verified

162
163
164def draw_facepose(image, lmks,eps=1):
165 H,W = image.shape[2:]
166 canvas = np.zeros(shape=(H, W, 3), dtype=np.uint8)
167 count =0
168 for lmk in lmks:
169 x, y = int(lmk[0]),int(lmk[1])
170 if (x > eps and y > eps) and (x < W and y < H):
171 # print(x,y)
172 count+=1
173 cv2.circle(canvas, (x, y), 3*H//800, (255, 255, 255), thickness=-1)
174
175
176 out = torch.from_numpy(canvas)/255
177 out = out.permute(2,0,1)[None,...].to(image.device)
178 out = torch.where(out==0,image,out)
179 return out
180
181
182def to_tensor(x,from_numpy=True,dtype='float32',device='cuda:0'):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected