Repository navigation
Check return value in python tutorial - #13877
Merged
Merged
Conversation
alalek
reviewed
Feb 21, 2019
| if cv.waitKey(1) & 0xFF == ord('q'): | ||
| # Display the resulting frame | ||
| cv.imshow('frame',gray) | ||
| if cv.waitKey(1) & 0xFF == ord('q') or not ret: |
Member
There was a problem hiding this comment.
& 0xFF
Not needed anymore with waitKey().
| # Our operations on the frame come here | ||
| gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) | ||
| # if frame is read correctly ret is True | ||
| if ret: |
Member
There was a problem hiding this comment.
What is about this?
if not ret:
print("Can't receive frame (stream end?). Exiting...")
break
At least we don't need to complicate condition below.
| cap = cv.VideoCapture(0) | ||
|
|
||
| if not cap.isOpened: | ||
| print("Cannot open VideoCapture") |
LaurentBerger
force-pushed
the
pythonvideo
branch
from
February 21, 2019 09:55
73884d7 to
7bad23d
Compare
LaurentBerger
force-pushed
the
pythonvideo
branch
from
February 21, 2019 10:02
3e4cc6e to
4ebb617
Compare
opencv-pushbot
pushed a commit
that referenced
this pull request
Feb 22, 2019
Merged
SavyaSanchi-Sharma
pushed a commit
to SavyaSanchi-Sharma/opencv
that referenced
this pull request
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
good practise in tutorial?