【发布时间】:2021-06-02 16:43:43
【问题描述】:
所以我想在我的代码中添加一个 while True 语句,这样当变量为 false 时它不起作用,但当变量更改为 true 时它会激活。在我的情况下,我有一个打开的 cv 摄像头,女巫扫描 QR 码并想知道如何激活它,因为它使用了一个 while true 语句。有任何想法吗。下面的例子
hello = false
r = input("hello or hi: ")
if r == 'hi':
hello = True
while hello = True:
_, img = cap.read()
data, bbox, _ = detector.detectAndDecode(img)
if bbox is not None:
for i in range(len(bbox)):
cv2.line(img, tuple(bbox[i][0]), tuple(bbox[(i + 1) % len(bbox)][0]), color=(255, 0, 0), thickness=2)
【问题讨论】:
标签: python function input while-loop