You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am new to visual tracking. Your code is the clearest implementation I have found. I tried to add my PC camera to track, but it seems that the bounding box is not able to move. I pastes my test code here. Thanks a lot if someone would help me!
importcskimportnumpyasnpfromscipy.miscimportimread, imsaveimportcv2# (Optional) OpenCV for drawing bounding boxeslength=14# sequence length# 1st frame's groundtruth informationx1=325# position x of the top-left corner of bounding boxy1=162# position y of the top-left corner of bounding boxwidth=74# the width of bounding boxheight=80# the height of bounding boxsequence_path="data/"# your sequence pathsave_path="save/"# your save pathtracker=csk.CSK() # CSK instancecap=cv2.VideoCapture(0)
flag=TruewhileTrue:
ret, img=cap.read()
frame=cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ifflag:
tracker.init(frame,x1,y1,width,height) # initialize CSK tracker with GT bounding boxflag=Falsecv2.rectangle(img, (x1, y1), (x1+width, y1+height), (0,255,0), 2)
cv2.imshow("original", img)
else:
x1, y1=tracker.update(frame) # update CSK tracker and output estimated positioncv2.rectangle(img, (x1, y1), (x1+width, y1+height), (0,255,0), 2)
cv2.imshow("frame", img)
k=cv2.waitKey(30) &0xFFifk==32:
break# clean up the camera and close any open windowscap.release()
cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered:
Hello, I am new to visual tracking. Your code is the clearest implementation I have found. I tried to add my PC camera to track, but it seems that the bounding box is not able to move. I pastes my test code here. Thanks a lot if someone would help me!
The text was updated successfully, but these errors were encountered: