# HandTracking **Repository Path**: null7916/hand-tracking ## Basic Information - **Project Name**: HandTracking - **Description**: 一个python小项目引用了OpenCV,实现摄像头识别手势控制电脑鼠标 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-09-25 - **Last Updated**: 2025-10-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Hand Gesture Mouse Control Project This is a Python project that controls the mouse through hand gesture recognition. It captures hand gestures via a camera to realize basic mouse operations such as movement, clicking, and scrolling. ## Features - **Gesture Recognition**: Detects finger states and gestures using hand keypoint detection. - **Mouse Control**: Maps gestures to mouse operations, including movement, clicking, releasing, and scrolling. - **Mode Switching**: Supports dynamic switching of gesture recognition modes to enhance interaction flexibility. - **Visual Markers**: Marks key finger positions on the image for debugging and demonstration purposes. ## Main Methods - `__init__()`: Initializes the camera and hand detection model. - `is_finger_straight()`: Determines whether a specified finger is straight. - `calculate_distance()`: Calculates the distance between two keypoints. - `mark_finger()`: Marks the key points of a specified finger on the image. - `map_coordinates()`: Maps gesture coordinates to screen coordinates. - `update_mode()`: Updates the gesture recognition mode. - `release_all_buttons()`: Releases all mouse buttons. - `handle_scroll()`: Performs scrolling based on gesture direction. - `process_frame()`: Processes each frame, executing gesture recognition and mouse control logic. - `run()`: Starts the main loop for real-time camera input processing and gesture control. ## Usage Instructions 1. Install required dependencies (e.g., OpenCV, MediaPipe). 2. Run the `handTracking.py` script to start the gesture control program. 3. Control the mouse using hand gestures without additional hardware. ## Notes - Ensure the camera is working properly and use the application in a well-lit environment. - Adjust gesture recognition sensitivity and mapping logic as needed. ## Open Source License This project is licensed under the MIT License. For details, see the `LICENSE` file in the project root directory.