Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/11_9.py

Created Mar 30, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.