cv2.waitKey(1)中的0xFF是什么? [英] What's 0xFF for in cv2.waitKey(1)?

查看:3641
本文介绍了cv2.waitKey(1)中的0xFF是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图理解0xFF在下面的代码片段中会做些什么:

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

有什么想法?

解决方案> 0xFF 是一个十六进制常量,它是 11111111 二进制。通过对这个常数使用按位AND(& ),它只保留原始的最后8位(在这种情况下,不管 cv2.waitKey (0)是)。


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

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

Any ideas?

解决方案

0xFF is a hexadecimal constant which is 11111111 in binary. By using bitwise AND (&) with this constant, it leaves only the last 8 bits of the original (in this case, whatever cv2.waitKey(0) is).

这篇关于cv2.waitKey(1)中的0xFF是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆