我在特定活动中的CSV文件中有人体姿势坐标。我写了一个预测函数,根据这些坐标检测活动(坐着,站立,弯曲)。我以列表形式进行活动。我想将此活动列表用作draw()的输入,并在框架上显示出来。我将不胜感激任何帮助。 我已经尝试过了:
cap = cv2.VideoCapture(input_source)
width = int(vcap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH))
height = int(vcap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT))
out = cv2.VideoWriter("output.mp4",-1,20.0,0,(width,height))
df = pd.read_csv(path)
f_no = 0
labels = detectors.check(normalized_data)
while (cap.isOpened()) :
ret,frame = cap.read()
if ret == True:
if f_no == df.frameCount.values:
try:
label = detectors.check(normalized_data) ## we need the normalix\zed data one list at a time
except:
pass
cv2.putText(frame,label,(105,105),cv2.FONT_HERSHEY_COMPLEX_SMALL,2,(0,0,255))
cv2.imshow("frame",frame)
if cv2.waitKey(1) & 0xFF == ord("q"):
break
else:
##increment
f_no +=1