import cv2 from pipeline_atm_getResult import atm_det def analysis_pph(imagepath,model_pp_hand,score_person): pph_re_list = [] score_pp_hand = atm_det.get_pph_result(imagepath,model_pp_hand) for pp_dic in score_pp_hand: person_bbox = list(score_person[0].values())[0] pp_bbox = list(pp_dic.values())[0] # print(person_bbox,pp_bbox) # 判断检测到的手部动作是否是工作人员,防止误识别客户的手部动作 # if int(pp_bbox[0]) and int(pp_bbox[2]) in range(int(person_bbox[0]),int(person_bbox[2])) and int(pp_bbox[1]) and int(pp_bbox[3]) in range(int(person_bbox[1]),int(person_bbox[3])): if int(pp_bbox[0]) and int(pp_bbox[2]) in range(int(person_bbox[0]),int(person_bbox[2])): # text_pph = ('Wrong action with',list(pp_dic.keys())[0]) pph_re_dict = {list(pp_dic.keys())[0]:pp_bbox} pph_re_list.append(pph_re_dict) # 加入图片输出 # print('Wrong action with',list(pp_dic.keys())[0]) else: continue return pph_re_list def analysis_button(imagepath,score_button,score_person): img = cv2.imread(imagepath) w,h,t = img.shape x_mid = w/2 re_list = [] for score_blue in score_button: # 选择右侧按键 # if ((score_blue[2] + score_blue[0])/2 + score_blue[0]) >= x_mid: person_bbox = list(score_person[0].values())[0] # 判断检测到的手部动作是否是工作人员,防止误识别客户的手部动作 if int(score_blue[0]) and int(score_blue[2]) in range(int(person_bbox[0]),int(person_bbox[2])): # if int(score_blue[0]) and int(score_blue[2]) in range(int(person_bbox[0]),int(person_bbox[2])) or int(score_blue[1]) and int(score_blue[3]) in range(int(person_bbox[1]),int(person_bbox[3])) # text_pph = ('Wrong action with',list(score_blue.keys())[0]) # pph_re_dict = {text_pph:pp_bbox} re_list.append(score_blue) pass # 加入图片输出 # print('Wrong action with',list(pp_dic.keys())[0]) else: # re_list.append('button action is right.') pass # else: # # button_dict ={'button_dict_right':{imagepath:score_blue}} # # re_list.append('button action is right.') # pass # print(re_list) # if len(re_list) == 0: # re_list.append('button action is right.') # print(re_list) return re_list