From cc18db847b50e44c95ac01237ab10c24f334e45a Mon Sep 17 00:00:00 2001 From: Tabs <54019007+Tabshhh@users.noreply.github.com> Date: Wed, 8 Jun 2022 17:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E8=AF=86=E5=88=AB=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=97=8B=E8=BD=AC=E5=90=8E=E6=95=B0=E6=8D=AE=E8=AF=86=E5=88=AB?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E4=BA=86=E6=8C=87=E5=85=B3=E8=8A=82?= =?UTF-8?q?=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/demo.py b/demo.py index a811c0d..5f30242 100644 --- a/demo.py +++ b/demo.py @@ -204,9 +204,14 @@ class HandDetector: else: knuckles.append(0) # 12 knuckles + distan = 0.22 for i in range(1, 5): for j in range(4): - if self.lmList[self.tipIds[i]-j][1] < self.lmList[self.tipIds[i]-j - 1][1]: + xx = self.lmList[self.tipIds[i]-j][1] + yy = self.lmList[self.tipIds[i]-j - 1][1] + if -distan < xx - yy < distan: + knuckles.append(2) + elif xx < yy: knuckles.append(1) else: knuckles.append(0)