How to use return value of a function as condition of while that returns tuple in python -
I was looking for something like this but I did not know that it goes here.
Some backgrounds I use opencv to get the frame from a video file. Usually people do this in the endless loop: or Now I want to recover all frames and loop I want to leave when there is no other frame, though my skills in dragon is not enough which I want to do. What I want to know I thought it would break the loop when success would be false but it was not. Then I thought it would work: It also did not work. I do not want to do anything like that (while): s, i = capture.read () if (s == wrong): break < / Pre> How can test the status of best to think of dragon Do not forget other languages
while (true): s, img = cv.read ()
for i in xrange (10000): # large number, img = cv.read ()
read function (or method, I do not know how they are called in Python ) A tube gives: First represents the success of the operation, and the second frame returns the frame when I want to break the loop when the first element of tuple is false. Being a background, I thought it would work:
while ((success, img = capture. Read ()) [0]): # sdh with img
while ((success, IMG = Capture.Red). Success: #Ads with IMG
in , a
if breaks if it does not succeed? < P>
s = true while s: s, i = capture.read () if S: do_some_stuff (i)
Comments
Post a Comment