Skip to content

Commit

Permalink
Fix for Python wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewssobral committed Jul 13, 2017
1 parent f927207 commit b2eb4db
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@
cv2.waitKey(1000)
print "Wait for the header"

pos_frame = capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
#pos_frame = capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
#pos_frame = capture.get(cv2.CV_CAP_PROP_POS_FRAMES)
pos_frame = capture.get(1)
while True:
flag, frame = capture.read()

if flag:
cv2.imshow('video', frame)
pos_frame = capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
#pos_frame = capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
#pos_frame = capture.get(cv2.CV_CAP_PROP_POS_FRAMES)
pos_frame = capture.get(1)
#print str(pos_frame)+" frames"

img_output = bgs.apply(frame)
Expand All @@ -71,15 +75,19 @@
cv2.imshow('img_bgmodel', img_bgmodel)

else:
capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, pos_frame-1)
print "Frame is not ready"
#capture.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, pos_frame-1)
#capture.set(cv2.CV_CAP_PROP_POS_FRAMES, pos_frame-1)
#capture.set(1, pos_frame-1)
#print "Frame is not ready"
cv2.waitKey(1000)
# break
break

if 0xFF & cv2.waitKey(10) == 27:
break

if capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES) == capture.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT):
break
#if capture.get(cv2.cv.CV_CAP_PROP_POS_FRAMES) == capture.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT):
#if capture.get(cv2.CV_CAP_PROP_POS_FRAMES) == capture.get(cv2.CV_CAP_PROP_FRAME_COUNT):
#if capture.get(1) == capture.get(cv2.CV_CAP_PROP_FRAME_COUNT):
#break

cv2.destroyAllWindows()

0 comments on commit b2eb4db

Please sign in to comment.