XuDongZhou commited on
Commit
e599390
·
verified ·
1 Parent(s): 49091f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -160,11 +160,14 @@ def convert_from_cv2_to_image(img: np.ndarray) -> Image:
160
  def convert_from_image_to_cv2(img: Image) -> np.ndarray:
161
  return cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
162
 
163
- def draw_kps(w,h, kps, color_list=[(255,0,0), (0,255,0), (0,0,255), (255,255,0), (255,0,255)]):
 
164
 
165
- stickwidth = 8
166
  limbSeq = np.array([[0, 2], [1, 2], [3, 2], [4, 2]])
 
167
 
 
168
  out_img = np.zeros([h, w, 3])
169
 
170
  for i in range(len(limbSeq)):
@@ -184,7 +187,6 @@ def draw_kps(w,h, kps, color_list=[(255,0,0), (0,255,0), (0,0,255), (255,255,0),
184
  x, y = kp
185
  out_img = cv2.circle(out_img.copy(), (int(x), int(y)), 10, color, -1)
186
 
187
- # out_img = out_img.astype(np.uint8)
188
  out_img_pil = PIL.Image.fromarray(out_img.astype(np.uint8))
189
  return out_img_pil
190
 
 
160
  def convert_from_image_to_cv2(img: Image) -> np.ndarray:
161
  return cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
162
 
163
+
164
+ def draw_kps(image_pil, kps, color_list=[(255,0,0), (0,255,0), (0,0,255), (255,255,0), (255,0,255)]):
165
 
166
+ stickwidth = 4
167
  limbSeq = np.array([[0, 2], [1, 2], [3, 2], [4, 2]])
168
+ kps = np.array(kps)
169
 
170
+ w, h = image_pil.size
171
  out_img = np.zeros([h, w, 3])
172
 
173
  for i in range(len(limbSeq)):
 
187
  x, y = kp
188
  out_img = cv2.circle(out_img.copy(), (int(x), int(y)), 10, color, -1)
189
 
 
190
  out_img_pil = PIL.Image.fromarray(out_img.astype(np.uint8))
191
  return out_img_pil
192