Skip to content

Commit

Permalink
reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentBerger committed Feb 21, 2019
1 parent 7bad23d commit 3e4cc6e
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions doc/py_tutorials/py_gui/py_video_display/py_video_display.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ import cv2 as cv

cap = cv.VideoCapture('vtest.avi')

while(cap.isOpened()):
while cap.isOpened():
ret, frame = cap.read()

# if frame is read correctly ret is True
if ret:
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)

cv.imshow('frame',gray)
if cv.waitKey(1) & 0xFF == ord('q') or not ret:
cv.imshow('frame', gray)
if cv.waitKey(1) == ord('q'):
break

cap.release()
Expand Down Expand Up @@ -129,20 +131,20 @@ cap = cv.VideoCapture(0)

# Define the codec and create VideoWriter object
fourcc = cv.VideoWriter_fourcc(*'XVID')
out = cv.VideoWriter('output.avi',fourcc, 20.0, (640,480))
out = cv.VideoWriter('output.avi', fourcc, 20.0, (640, 480))

while(cap.isOpened()):
while cap.isOpened():
ret, frame = cap.read()
if ret==True:
frame = cv.flip(frame,0)
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
frame = cv.flip(frame, 0)

# write the flipped frame
out.write(frame)
# write the flipped frame
out.write(frame)

cv.imshow('frame',frame)
if cv.waitKey(1) & 0xFF == ord('q'):
break
else:
cv.imshow('frame', frame)
if cv.waitKey(1) == ord('q'):
break

# Release everything if job is finished
Expand Down

0 comments on commit 3e4cc6e

Please sign in to comment.