Combines Intel RealSense and Mediapipe for hand tracking.
Project description
Realsense Mediapipe Tracking
This is a project to integrate the use of a Realsense d435 depth camera with Mediapipe for tracking the position of a subjects hand.
Using UV for package management.
Mediapipe requires python 3.12 or older unless built from source.
Example Streaming
import sys
import os
sys.path.append(os.path.abspath("src/realsense_mediapipe_tracking"))
import time
from src.realsense_mediapipe_tracking.camera import realsenseCamera
from src.realsense_mediapipe_tracking.hand_tracking import handTrack
def main():
# Initialize the RealSense camera with desired parameters
cam = realsenseCamera(width=640, height=480, fps=30)
# Initialize the hand tracking class with the camera object
track = handTrack(cam)
try:
# Start streaming
print("Starting stream...")
track.stream()
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Stop the camera and release resources
cam.stop()
if __name__ == "__main__":
main()
Example direct x y z coordinate printing
import sys
import os
sys.path.append(os.path.abspath("src/realsense_mediapipe_tracking"))
from src.realsense_mediapipe_tracking.camera import realsenseCamera
from src.realsense_mediapipe_tracking.hand_tracking import handTrack
def main():
# Initialize the RealSense camera
cam = realsenseCamera()
# Initialize the hand tracking class with the camera object
tracker = handTrack(cam)
try:
while True:
color_image, depth_image, depth_frame = tracker.cam.get_frames()
if color_image is None or depth_image is None:
continue
landmarks_xyz, results = tracker.tracking(color_image, depth_frame)
# Print the XYZ coordinates for each hand
for hand_xyz in landmarks_xyz:
for idx, (X, Y, Z) in enumerate(hand_xyz):
print(f"Landmark {idx}: X={X:.2f}m, Y={Y:.2f}m, Z={Z:.2f}m")
except Exception as e:
print(f"An error occurred: {e}")
finally:
cam.stop()
if __name__ == "__main__":
main()
Required external libraries: https://github.com/IntelRealSense/librealsense
Licensed under GNU GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file realsense_mediapipe_tracking-0.1.3.tar.gz.
File metadata
- Download URL: realsense_mediapipe_tracking-0.1.3.tar.gz
- Upload date:
- Size: 29.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc6ffe0027fab3029435a0acace668c2956d99d48c034b43d16bb24f0a2dacef
|
|
| MD5 |
e535f5ea70a5dfb4fa24f69fa773bba6
|
|
| BLAKE2b-256 |
b902c98269f02a383fbe7a7853d06e7dcc3577286bd17f3bb35890bb81e3f3ba
|
Provenance
The following attestation bundles were made for realsense_mediapipe_tracking-0.1.3.tar.gz:
Publisher:
publish.yml on vi-vi-3482/realsense_mediapipe_tracking
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
realsense_mediapipe_tracking-0.1.3.tar.gz -
Subject digest:
fc6ffe0027fab3029435a0acace668c2956d99d48c034b43d16bb24f0a2dacef - Sigstore transparency entry: 949943779
- Sigstore integration time:
-
Permalink:
vi-vi-3482/realsense_mediapipe_tracking@47556388a7819b0bf564870ba41842e3dcf6548f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/vi-vi-3482
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47556388a7819b0bf564870ba41842e3dcf6548f -
Trigger Event:
push
-
Statement type:
File details
Details for the file realsense_mediapipe_tracking-0.1.3-py3-none-any.whl.
File metadata
- Download URL: realsense_mediapipe_tracking-0.1.3-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f469fe6369b1bb1e7b532d5a3828408735837344e656ef340d2c3fc13f8c9738
|
|
| MD5 |
1f8220300d47601b7f8ce7c62b36e050
|
|
| BLAKE2b-256 |
c9d56afa535c889887be6bb99c2bba9bc3d230d764bf1708af31f9a8b083a561
|
Provenance
The following attestation bundles were made for realsense_mediapipe_tracking-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on vi-vi-3482/realsense_mediapipe_tracking
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
realsense_mediapipe_tracking-0.1.3-py3-none-any.whl -
Subject digest:
f469fe6369b1bb1e7b532d5a3828408735837344e656ef340d2c3fc13f8c9738 - Sigstore transparency entry: 949943817
- Sigstore integration time:
-
Permalink:
vi-vi-3482/realsense_mediapipe_tracking@47556388a7819b0bf564870ba41842e3dcf6548f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/vi-vi-3482
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47556388a7819b0bf564870ba41842e3dcf6548f -
Trigger Event:
push
-
Statement type: