Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
IT Management Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Formanek Balázs István
IT Management Project
Commits
7041b274
Commit
7041b274
authored
6 months ago
by
Vajay Mónika
Browse files
Options
Downloads
Patches
Plain Diff
smoother scrolling and moving
parent
7bb4bc58
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
developement.txt
+3
-0
3 additions, 0 deletions
developement.txt
final_project/main.py
+1
-0
1 addition, 0 deletions
final_project/main.py
final_project/mouse_class.py
+8
-1
8 additions, 1 deletion
final_project/mouse_class.py
with
12 additions
and
1 deletion
developement.txt
+
3
−
0
View file @
7041b274
...
...
@@ -15,4 +15,7 @@ Megbeszélés 2024. 11. 31:
mozdulatok:
drag: nyitott tenyér -> drop sima cursor stop if előtte drag
Móni 2024. 11. 22.:
- egér mozgatás már nem szaggatott
\ No newline at end of file
This diff is collapsed.
Click to expand it.
final_project/main.py
+
1
−
0
View file @
7041b274
...
...
@@ -85,6 +85,7 @@ def main():
mouse
.
add_prediction
(
mouse_command
)
if
mouse_command
==
"
move cursor
"
or
"
grab
"
:
mouse
.
get_hand_pos
(
landmark_list
[
8
])
# transform back RGB and show frame with annotation
frame_annotated
=
cv2
.
cvtColor
(
frameRGB
,
cv2
.
COLOR_RGB2BGR
)
cv2
.
imshow
(
'
Hand tracking
'
,
frame_annotated
)
...
...
This diff is collapsed.
Click to expand it.
final_project/mouse_class.py
+
8
−
1
View file @
7041b274
...
...
@@ -14,7 +14,7 @@ class Mouse:
self
.
freeze_action
=
False
# parameters to fine-tune
self
.
action_length
=
5
self
.
action_length
=
1
5
#self.move_distance = 10
self
.
scroll_distance
=
50
#self.time_checking = 0.5
...
...
@@ -28,6 +28,13 @@ class Mouse:
self
.
predictions
.
append
(
prediction
)
if
len
(
self
.
predictions
)
==
self
.
action_length
:
self
.
make_action
()
elif
self
.
previous_action
in
{
"
move cursor
"
,
"
scrolling up
"
,
"
scrolling down
"
,
"
scrolling left
"
,
"
scrolling right
"
}:
if
len
(
self
.
predictions
)
>
3
:
safe_action
=
self
.
get_major_element
(
self
.
predictions
[
-
3
:])
if
safe_action
==
self
.
previous_action
:
self
.
mouse_control
(
self
.
previous_action
)
else
:
self
.
mouse_control
(
self
.
previous_action
)
def
make_action
(
self
):
action
=
self
.
get_major_element
(
self
.
predictions
)
...
...
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