Why its necessary to have cv2.waitKey() & 0xff to run video

asked 2020-04-03 05:52:54 -0500

seems like without cv2.waitKey() & 0xff my video capture wont start.. What if I want another stopping method? for example:

 roi = None
roi = cv2.selectROI(frame, False) #on the live stream getting region of interest

if cv2.waitKey(10) & roi != None:

this doesn't seems to work..

roi values are correct (tuple with 4 vaues)

getting this error

unsupported operand type(s) for &: 'int' and 'NoneType'
edit retag flag offensive close merge delete



I failt to understand what the bitwise AND would do there...

mvuori gravatar imagemvuori ( 2020-04-03 06:04:25 -0500 )edit

if I waited 10ms and the value roi became true (instead if None) after I selected region of interest under cv2.selectROI function... this is what I want - after I selected roi to close the stream window and proceed to work..

simonsk1990 gravatar imagesimonsk1990 ( 2020-04-03 06:17:28 -0500 )edit

cv2.imshot does not exist and the indentation is broken'

and cv2.selectROI() wont ever return None

berak gravatar imageberak ( 2020-04-03 08:04:06 -0500 )edit