FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-beginner-projects/projects/HandTrack/base.py at main · RealPythonProjects/python-beginner-projects · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
RealPythonProjects
/
python-beginner-projects
Public
forked from
Mrinank-Bhowmick/python-beginner-projects
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-beginner-projects
/
projects
/
HandTrack
/
base.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (39 loc) · 1.25 KB
Breadcrumbs
python-beginner-projects
/
projects
/
HandTrack
/
base.py
Copy path
File metadata and controls
44 lines (39 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import
cv2
import
mediapipe
as
mp
import
time
mp_drawing
=
mp
.
solutions
.
drawing_utils
mp_drawing_styles
=
mp
.
solutions
.
drawing_styles
mp_hands
=
mp
.
solutions
.
hands
pTime
=
0
cTime
=
0
cap
=
cv2
.
VideoCapture
(
0
)
hands
=
mp_hands
.
Hands
()
while
True
:
success
,
image
=
cap
.
read
()
if
not
success
:
print
(
"Ignoring empty camera frame."
)
continue
cTime
=
time
.
time
()
fps
=
1
/
(
cTime
-
pTime
)
pTime
=
cTime
image
.
flags
.
writeable
=
False
image
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_BGR2RGB
)
results
=
hands
.
process
(
image
)
image
.
flags
.
writeable
=
True
image
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_RGB2BGR
)
if
results
.
multi_hand_landmarks
:
for
hand_landmarks
in
results
.
multi_hand_landmarks
:
mp_drawing
.
draw_landmarks
(
image
,
hand_landmarks
,
mp_hands
.
HAND_CONNECTIONS
,
mp_drawing_styles
.
DrawingSpec
(
color
=
(
0
,
0
,
256
)),
mp_drawing_styles
.
DrawingSpec
(
color
=
(
0
,
256
,
0
)),
)
image
=
cv2
.
flip
(
image
,
1
)
cv2
.
putText
(
image
,
str
(
int
(
fps
)), (
500
,
400
),
cv2
.
FONT_HERSHEY_PLAIN
,
3
, (
120
,
52
,
40
),
3
)
cv2
.
imshow
(
"Camera Result"
,
image
)
# print(fps)
cv2
.
waitKey
(
1
)
Back
|
FazBrowse Home
|
New Git URL