Skip to content

Instantly share code, notes, and snippets.

Created April 28, 2020 18:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aravindpai/f0b48efe693956bff63540faa919a896 to your computer and use it in GitHub Desktop.
#define a function which return the bottom center of every bbox
def mid_point(img,person,idx):
#get the coordinates
x1,y1,x2,y2 = person[idx]
_ = cv2.rectangle(img, (x1, y1), (x2, y2), (0,0,255), 2)
#compute bottom center of bbox
x_mid = int((x1+x2)/2)
y_mid = int(y2)
mid = (x_mid,y_mid)
_ =, mid, 5, (0, 0, 255), -1)
cv2.putText(img, str(idx), mid, cv2.FONT_HERSHEY_SIMPLEX,1, (255, 255, 255), 2, cv2.LINE_AA)
return mid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment