Comments (1)
self answer .. (I resolved by myself.)
# STEP 2: Create an GestureRecognizer object.
VisionRunningMode = mp.tasks.vision.RunningMode
base_options = python.BaseOptions(model_asset_path='gesture_recognizer.task')
options = vision.GestureRecognizerOptions(base_options=base_options, running_mode=VisionRunningMode.VIDEO )
recognizer = vision.GestureRecognizer.create_from_options(options)
results = []
cap = cv2.VideoCapture(video_file_path)
fps = cv2.CAP_PROP_FPS
calc_timestamps = [0.0]
res_landmark = []
res_not_found_count = 0
ret = True
while ret:
ret, img = cap.read() # read one frame from the 'capture' object; img is (H, W, C)
if ret:
ts = cap.get(cv2.CAP_PROP_POS_MSEC)
cts = calc_timestamps[-1] + 1000/fps
#print(abs(ts-cts))
recognition_result =recognizer.recognize_for_video( mp.Image(image_format=ImageFormat.SRGB, data=img), int(ts))
try :
top_gesture = recognition_result.gestures[0][0]
hand_landmarks = top_gesture.category_name
#print(hand_landmarks)
results.append(top_gesture)
res_landmark.append(hand_landmarks)
except IndexError:
res_landmark.append('-')
res_not_found_count += 1
continue
cap.release()
cv2.destroyAllWindows
from mediapipe-samples.
Related Issues (20)
- Module installation error in raspberry pi 4
- 'ERROR: Unable to read from webcam. Please verify your webcam settings.' HOT 2
- No module named 'mediapipe.tasks'
- TypeError: ImageSegmenterOptions.__init__() got an unexpected keyword argument 'output_category_mask'
- Xcode: Getting Failed to initialize LlmInference session -> Failed to map, error: Cannot allocate memory
- HandLandmarker CodePen example outdated
- Issues for a change of trained model HOT 1
- Difference in performance between sample face mesh app and web demo.
- LLM Inference Android Sample Issue: collectIndexed in sendMessage Causes Duplicate Collections on Multiple Invocations
- Can't Serve Files Locally in Python Due to CORS
- Image Segmentation Live Stream Mode for Python
- Crash when running Android text classification sample with MobileBERT. HOT 4
- Gesture Recognizer example with Raspberry Pi performance issues HOT 2
- Synchronize this proposal with the language steering group's amendment for the Swift 6 language mode, as [announced](https://forums.swift.org/t/amendment-se-0192-handling-future-enum-cases/68321) and [implemented for Swift 6.0](https://github.com/apple/swift/pull/73481).
- Can mediapipe-models be used for free for commercial purposes ? HOT 1
- RuntimeWarning: overflow encountered in cast v.numpy().astype("float16").tofile(output_bin_file) HOT 2
- Android LLM Inference Conversion guide for models fine tuned with keras nlp
- LLM Models other than Gemma , falcon, phi, stablelm HOT 1
- About face_detector performance issues in android HOT 3
- How to get LLM model performance? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mediapipe-samples.