def gen_frames(): global current_human_count, capturing_blocked while True: success, frame = camera.read() if not success: break frame, count = detect_human(frame) _, buffer = cv2.imencode('.jpg', frame) frame = buffer.tobytes() buffer_encoded = base64.b64encode(buffer).decode("utf-8") if count > current_human_count and not capturing_blocked: capturing_blocked = True socket.emit("imgFeed", buffer_encoded) save_frame(time.time(), buffer_encoded) threading.Thread(target=unlock_capture, args=(2, )).start() current_human_count = count socket.emit("countFeed", count) yield (b'--frame\r\nContent-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
_v = variables[target_ip] # print("#2") if stage == 1 and _v['playing'] == False: ''' 로비에서 대기중인 상황. crop_detector로 모니터링하다가 사람이 탑승하면 age/gender/color 파악하고 정보 저장. 파악이 끝나면 기본 안내멘트 재생. 재생 후 양손이 디텍트되면 게임 스타트 매크로 시작. + 스타트 멘트 재생 ''' # print(_v) if 'cam' in _v: cam = _v['cam'] # print(_v) if _v['person_attr']['gender'] == None: while True: human_box = detect_human(cam) gender = detect_gender(human_box) print("13") if gender is not None: break # print("G:",gender) _v['person_attr']['gender'] = gender print("#1") else: if _v['intro'] == False: a_thread = Thread(target=playFile, args=( target_ip, 'test_intro',