如图我已经触发了Start按钮,且按照项目要求Start按钮触发的程序要持续运行,那么此时我应该如何触发Quit按钮?
def start():
cap = cv2.VideoCapture(0)
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor('F:\\shape_predictor_68_face_landmarks.dat\\shape_predictor_68_face_landmarks.dat')
while True:
ret, frame = cap.read()
dets = detector(frame, 1)
if len(dets) > 0:
for i, d in enumerate(dets):
x, y, w, h = d.left(),d.top(),d.right(),d.bottom()
cv2.rectangle(frame, (x - 10, y - 10), ( w + 10, h + 10), (0, 255, 0), 2)
shape = predictor(frame, d)
for index, pt in enumerate(shape.parts()):
pt_pos = (pt.x, pt.y)
cv2.circle(frame, pt_pos, 1, (255, 0, 0), 2)
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(frame, str(index+1),pt_pos,font, 0.3, (0, 0, 255), 1, cv2.LINE_AA)
cv2.imshow('frame', frame)
cap.release()
cv2.destroyAllWindows()