Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created March 30, 2020 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aravindpai/314e9b4210087fd93ede5d8e41e97692 to your computer and use it in GitHub Desktop.
Save aravindpai/314e9b4210087fd93ede5d8e41e97692 to your computer and use it in GitHub Desktop.
files = ball_df['frame'].values
num=10
for idx in range(len(files)):
#draw contours
img = cv2.imread('frames/'+files[idx])
x=ball_df.loc[idx,'x']
y=ball_df.loc[idx,'y']
w=ball_df.loc[idx,'w']
h=ball_df.loc[idx,'h']
xmin=x-num
ymin=y-num
xmax=x+w+num
ymax=y+h+num
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), (255,0,0), 2)
cv2.imwrite("frames/"+files[idx],img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment