Created
March 30, 2020 14:04
-
-
Save aravindpai/314e9b4210087fd93ede5d8e41e97692 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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