Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/10_18.py

Created Apr 28, 2020
Embed
What would you like to do?
def find_closest_people(name,thresh):
img = cv2.imread('frames/'+name)
outputs = predictor(img)
classes=outputs['instances'].pred_classes.cpu().numpy()
bbox=outputs['instances'].pred_boxes.tensor.cpu().numpy()
ind = np.where(classes==0)[0]
person=bbox[ind]
midpoints = [mid_point(img,person,i) for i in range(len(person))]
num = len(midpoints)
dist= compute_distance(midpoints,num)
p1,p2,d=find_closest(dist,num,thresh)
img = change_2_red(img,person,p1,p2)
cv2.imwrite('frames/'+name,img)
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.