diff --git a/cv2_test.py b/cv2_test.py index 12fe988..34355f9 100644 --- a/cv2_test.py +++ b/cv2_test.py @@ -25,7 +25,7 @@ def ShapeDetection(img:cv2.typing.MatLike): percentage=nonzero_num/img_obj.size # print(f"nonzero_num:{nonzero_num},size={img_obj.size}, pos:{percentage}") # 通过计算图像白值的比例来判断实心还是空心 - if(percentage>0.55): + if(percentage>0.63): boll_count+=1 return (all_cont,boll_count) diff --git a/index.json b/index.json index b625b04..209af0f 100644 --- a/index.json +++ b/index.json @@ -1,3 +1,3 @@ { - "index": 3185 + "index": 8538 } \ No newline at end of file diff --git a/touch2.py b/touch2.py index 656bfeb..e08b8e0 100644 --- a/touch2.py +++ b/touch2.py @@ -29,9 +29,11 @@ def flush_wind_pos(): not_find=True time.sleep(1) continue - _ocr_pos=[pos[0]+0,pos[1]+180,375,296] - _ocr_boll=[pos[0]+99,pos[1]+440,172,27] - _mouse_touch=[pos[0]+0,pos[1]+603,145,70] + w=pos[2]-pos[0] + h=pos[3]-pos[1] + _ocr_pos=[pos[0]+0,pos[1]+int(180/877*h),w,int(296/877*h)] + _ocr_boll=[pos[0]+int(99/376*w),pos[1]+int(440/877*h),int(172/376*w),int(27/877*h)] + _mouse_touch=[pos[0]+0,pos[1]+int(603/877*h),int(145/376*w),int(70/877*h)] return # 识别屏幕文字 @@ -110,7 +112,7 @@ class ser(object): self.x=x self.y=y def touch(self): - self.write(f"Z4\r") + self.write(f"Z6\r") time.sleep(0.1) self.write(f"Z0\r") time.sleep(0.05) @@ -137,26 +139,38 @@ class ser(object): def password(self,p:str): index=0 p_len=len(p) + try_times=0 while index20): + myprint(f"尝试次数过多 times={try_times},退出") + s.back() + return False + else: + myprint(f"密码输入状态异常 index={index},num={num},password={p}") + s.back() + return False @@ -179,10 +193,11 @@ if __name__ == "__main__": while(True): try: text=identify_text() - if(find_text(text,"安装系统软件")): + if(find_text(text,"安装系统")): unknown_scr=False myprint("进入密码界面") s.enter() + time.sleep(0.2) # s.avoid() elif(find_text(text,"请输入解锁密码")): unknown_scr=False @@ -218,20 +233,20 @@ if __name__ == "__main__": if __name__ == "__main1__": - # identify_text() - # get_scr(_ocr_pos[0],_ocr_pos[1],_ocr_pos[2],_ocr_pos[3],f"test") - # find_input_count() - s=ser() - s.open("com8") - s.avoid() - while True: - try: - s.password_test("1234567890") - except Exception as e: - myprint(e) - break - except KeyboardInterrupt as k: - myprint(k) - break - s.reset() - s.close() + identify_text() + get_scr(_ocr_pos[0],_ocr_pos[1],_ocr_pos[2],_ocr_pos[3],f"test") + find_input_count() + # s=ser() + # s.open("com8") + # s.avoid() + # while True: + # try: + # s.password_test("1234567890") + # except Exception as e: + # myprint(e) + # break + # except KeyboardInterrupt as k: + # myprint(k) + # break + # s.reset() + # s.close()