From 15f1c21c9992e25869ca059083afded08f7d5c8f Mon Sep 17 00:00:00 2001 From: ahao Date: Tue, 20 Sep 2022 12:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=97=A0=E6=95=88=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=20=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=97=E5=B0=8F?= =?UTF-8?q?=E6=95=B0=20=E6=AD=A5=E6=9E=AA=E5=B7=A6=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E5=85=B6=E5=AE=83=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/AiController.py | 15 ++++++++++++--- controller/PubgWeaponConfigController.py | 3 ++- resource/APEX/ghubscripts.json | 2 +- resource/APEX/lgsscripts.json | 2 +- resource/PUBG/ghubscripts.json | 2 +- resource/PUBG/lgsscripts.json | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/controller/AiController.py b/controller/AiController.py index 9068620..9b83a28 100644 --- a/controller/AiController.py +++ b/controller/AiController.py @@ -306,7 +306,7 @@ def recognize(self): int(it+ih+(self.ai.fixregion/3)*ih) ) - if ok and self.pointer_in_range(center,bbox): + if ok and self.pointer_in_range(center,bbox) and self.area_limit(bbox): cv.rectangle(simg,ip1,ip2,(0,255,0),3,cv.LINE_AA) cv.putText(simg, "TARGET", ip1, cv.FONT_HERSHEY_SIMPLEX, 1, (0,0,255), 3,cv.LINE_AA) cv.rectangle(simg,op1,op2,(255,178,50),1,cv.LINE_AA) @@ -336,7 +336,10 @@ def recognize(self): if box: boxcenter,bbox = self.findclose(box,center,width,height) - if boxcenter: + if not self.area_limit(bbox): + self.box = None + self.qt_comunicate.update.emit({"move":(0,0)}) + elif boxcenter: trackimg = cv.cvtColor(cvimg,cv.COLOR_BGRA2BGR) trackimg,_ = self.ai.circle_mask(cvimg) @@ -362,11 +365,17 @@ def recognize(self): text = "{}fps".format(round(1/(time.time()-self.strat_time))) cv.putText(img,text,(5,50),cv.FONT_HERSHEY_SIMPLEX,1,(0,255,0),2) - if box and bbox: + if box and bbox and self.area_limit(bbox): cv.rectangle(img,(bbox[0],bbox[1]),(bbox[0]+bbox[2],bbox[1]+bbox[3]),(0,255,0),3,cv.LINE_AA) cv.circle(img,center,5,(0,255,0),3,cv.LINE_AA) qimg = cv_img_to_qimg(img) self.qt_comunicate.update.emit({"img":qimg}) if self.qt_comunicate else None + + def area_limit(self,bbox): + radius = round(640*self.ai.airegion) + detech_area = radius*radius*math.pi + box_area = bbox[2] *bbox[3] + return box_area/detech_area <0.5 and bbox[2]/bbox[3]<1 def pointer_in_range(self,point,xywh): il,it,iw,ih = xywh diff --git a/controller/PubgWeaponConfigController.py b/controller/PubgWeaponConfigController.py index 3981bdf..1532ef9 100644 --- a/controller/PubgWeaponConfigController.py +++ b/controller/PubgWeaponConfigController.py @@ -205,7 +205,7 @@ def cal_data_result(self): continue dsplit = d.split(",") keys_sorted.append(int(dsplit[0])) - datas_result[int(dsplit[0])] = [int(dsplit[1]),int(dsplit[2])] + datas_result[int(dsplit[0])] = [float(dsplit[1]),float(dsplit[2])] keys_sorted.sort() self.view.weapon_data_result.setText("这里显示最终结果") @@ -241,6 +241,7 @@ def cal_data_result(self): self.datas["weapons"][weapon_name]["countdatax"] = countdatax self.datas["weapons"][weapon_name]["countdatay"] = countdatay except: + traceback.print_exc() self.view.weapon_data_result.setText("") self.apply() diff --git a/resource/APEX/ghubscripts.json b/resource/APEX/ghubscripts.json index 34d8257..7e2d29a 100644 --- a/resource/APEX/ghubscripts.json +++ b/resource/APEX/ghubscripts.json @@ -18,7 +18,7 @@ false ], "ads": [ - "\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~=1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", + "\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1) or vars[\"right\"]\n end\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~=1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", "", "", false diff --git a/resource/APEX/lgsscripts.json b/resource/APEX/lgsscripts.json index 84ebf55..5c3c559 100644 --- a/resource/APEX/lgsscripts.json +++ b/resource/APEX/lgsscripts.json @@ -24,7 +24,7 @@ false ], "ads": [ - "\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", + "\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1) or vars[\"right\"]\n end\n\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and IsKeyLockOn(\"Capslock\")) or (vars[\"left\"] and step ~= 1)\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", "", "", false diff --git a/resource/PUBG/ghubscripts.json b/resource/PUBG/ghubscripts.json index 07c3782..b01fe75 100644 --- a/resource/PUBG/ghubscripts.json +++ b/resource/PUBG/ghubscripts.json @@ -42,7 +42,7 @@ false ], "ads": [ - "\n if vars[\"adsmode\"] == \"HOLD\" then\n return (IsMouseButtonPressed(1) and IsMouseButtonPressed(3)) or (IsMouseButtonPressed(1) and vars[\"aim\"])\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return IsMouseButtonPressed(1) and IsKeyLockOn(\"Capslock\")\n end\n", + "\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] or #table[vars[\"weapon\"]][\"countdatax\"] == 1 then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) or vars[\"right\"]\n end\n return (IsMouseButtonPressed(1) and IsMouseButtonPressed(3)) or (IsMouseButtonPressed(1) and vars[\"aim\"])\n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return IsMouseButtonPressed(1) and IsKeyLockOn(\"Capslock\")\n end\n", "", "", false diff --git a/resource/PUBG/lgsscripts.json b/resource/PUBG/lgsscripts.json index 9e03f57..2bb128f 100644 --- a/resource/PUBG/lgsscripts.json +++ b/resource/PUBG/lgsscripts.json @@ -42,7 +42,7 @@ false ], "ads": [ - "\n if vars[\"adsmode\"] == \"HOLD\" then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) \n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", + "\n if vars[\"adsmode\"] == \"HOLD\" then\n if not table[vars[\"weapon\"]] or #table[vars[\"weapon\"]][\"countdatax\"] == 1 then\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) or vars[\"right\"]\n end\n return (vars[\"left\"] and vars[\"right\"]) or (vars[\"left\"] and vars[\"aim\"]) \n end\n if vars[\"adsmode\"] == \"CLICK\" then\n return vars[\"left\"] and IsKeyLockOn(\"Capslock\")\n end\n", "", "", false