how to limit frame using FSP property using python opencv

asked 2015-02-25 23:40:51 -0600

GEST gravatar image

updated 2015-02-26 01:14:45 -0600

berak gravatar image

i was trying to set FPS property to limit the frame per second... but, values are same and no frame are setting.

vid=cv.CaptureFromFile('out.mp4')
print cv.GetCaptureProperty(vid,cv.CV_CAP_PROP_FPS)
cv.SetCaptureProperty(vid,cv.CV_CAP_PROP_FPS,1)
print cv.GetCaptureProperty(vid,cv.CV_CAP_PROP_FPS)
fgbg = cv2.BackgroundSubtractorMOG()
#success,image=vid.read()
image=cv.QueryFrame(vid)
count=0
while image:
    #fgmask=fgbg.apply(image)
    #cv2.imwrite("frame%d.jpg" % count,fgmask)
    cv.SaveImage('pic'+str(count)+'.jpg', image)
    if cv.WaitKey(10)==27:
        break
    count+=1
    #success,image=vid.read()
    image=cv.QueryFrame(vid)
edit retag flag offensive close merge delete

Comments

please, stop using the old cv interface in favour of cv2, it won't be there anymore in opencv3.0

berak gravatar imageberak ( 2015-02-26 01:15:49 -0600 )edit