What's 0xFF for in cv2.waitKey(1)?

前端 未结 8 2089
走了就别回头了
走了就别回头了 2020-12-02 10:36

I\'m trying understand what 0xFF does under the hood in the following code snippet:

if cv2.waitKey(0) & 0xFF == ord(\'q\'):
    break

A

8条回答
  •  没有蜡笔的小新
    2020-12-02 10:55

    cv2.waitKey() is the function which bind your code with keyboard and any thing you type will be returned by this function. output from waitKey is then logically AND with 0xFF so that last 8 bits can be accessed. Therefore last 8 bit represent input from keyboard and this is compared using == with the character you want.

提交回复
热议问题