Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OpenCV-Hand-Gesture-Control
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David
OpenCV-Hand-Gesture-Control
Commits
5be42766
Commit
5be42766
authored
3 years ago
by
David
Browse files
Options
Downloads
Patches
Plain Diff
Added feature to improve accuracy of numbers up
parent
9fcc3125
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/GestureLibs/GestureDetector.py
+6
-5
6 additions, 5 deletions
modules/GestureLibs/GestureDetector.py
with
6 additions
and
5 deletions
modules/GestureLibs/GestureDetector.py
+
6
−
5
View file @
5be42766
...
...
@@ -21,7 +21,7 @@ class GestureDetector:
detection_window
=
3
detection_wait
=
3
FingerTipsData
=
[]
number_up
=
None
number_up
=
[]
detection_frames
=
[]
start_time
=
None
end_time
=
None
...
...
@@ -90,18 +90,18 @@ class GestureDetector:
if
self
.
detection_start
==
True
and
self
.
number_start
==
1
and
self
.
end_time
!=
None
:
now
=
int
(
time
.
time
())
up_list
=
[]
if
now
<=
self
.
end_time
:
up_list
=
[]
for
finger
in
self
.
FingersList
:
finger_tip
=
finger
.
tip
fingertip_coord
=
finger
.
tip_coord
(
finger_tip
,
input_list
)
print
(
"
fingertip_coord
"
,
fingertip_coord
)
self
.
detection_frames
.
append
(
fingertip_coord
)
up_list
.
append
(
finger
.
is_up
(
input_list
))
self
.
detection_frames
.
append
(
fingertip_coord
)
for
i
in
up_list
:
if
not
i
:
up_list
.
remove
(
i
)
self
.
number_up
=
len
(
up_list
)
self
.
number_up
.
append
(
len
(
up_list
)
)
elif
now
>=
self
.
end_time
:
self
.
in_cooldown
=
True
self
.
cooldown_end
=
now
+
5
...
...
@@ -173,13 +173,13 @@ class GestureDetector:
# To find the majority of the directions of fingers, the fingers direction have to be mapped to an integer value
DirectionsList
=
convert_dir_id
(
DirectionsList
)
GestureDirection
=
findMajority
(
DirectionsList
)
self
.
number_up
=
findMajority
(
self
.
number_up
)
GestureDirection
=
convert_dir_id
(
GestureDirection
)
print
(
GestureDirection
)
print
(
self
.
number_up
)
print
(
len
(
self
.
GestureList
))
dev_1plus
=
self
.
number_up
+
1
dev_1minus
=
self
.
number_up
-
1
for
gesture
in
self
.
GestureList
:
print
(
gesture
.
direction
,
gesture
.
fingers_up
,
type
(
gesture
.
fingers_up
))
# Now matches gesture with the GestureList that was imported from main
...
...
@@ -193,4 +193,5 @@ class GestureDetector:
print
(
"
No Gesture Detected
"
)
self
.
FingerTipsData
=
[]
self
.
number_up
=
[]
self
.
create_fingertips
()
# Clears FingerTipsData and recreates empty template
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment