The document contains a Python script that uses OpenCV to capture video from a webcam and detect finger positions and names using specified landmarks. It counts how many fingers are raised or lowered based on their positions and displays the results in real-time. The script continues to run until the 'q' key is pressed, at which point it releases the webcam and closes all OpenCV windows.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
1 views2 pages
Handgesture
The document contains a Python script that uses OpenCV to capture video from a webcam and detect finger positions and names using specified landmarks. It counts how many fingers are raised or lowered based on their positions and displays the results in real-time. The script continues to run until the 'q' key is pressed, at which point it releases the webcam and closes all OpenCV windows.
fingers = [] # Check thumb (index 0) separately because it moves differently from other fingers if landmarks_positions[4][1] > landmarks_positions[3][1]: # Adjusted logic fingers.append(1) print(landmark_names[4]) else: fingers.append(0)
# Check other four fingers
for i in range(4): if landmarks_positions[tip_indices[i]][2] < landmarks_positions[tip_indices[i] - 2][2]: fingers.append(1) print(landmark_names[tip_indices[i]]) else: fingers.append(0)