A hand detection library based on MediaPipe and OpenCV
Project description
HandInd
基于 MediaPipe 和 OpenCV 的手部检测库
功能特性
- 实时检测手部位置
- 计算手部边界框
- 支持自定义回调处理检测结果
- 支持配置化参数
安装
pip install handind
快速开始
基本使用
from handind import HandDetector, HandDetectionResult
def on_hand_detected(results):
for hand in results:
print(f"手部{hand.hand_index}位置: ({hand.xmin},{hand.ymin})")
detector = HandDetector()
detector.start_detection(callback=on_hand_detected)
使用快速函数
from handind import quick_detect, HandDetectionResult
def on_detect(results):
for hand in results:
print(f"手部{hand.hand_index}: ({hand.xmin},{hand.ymin})")
quick_detect(on_detect)
自定义配置
from handind import HandDetector, HandDetectorConfig
config = HandDetectorConfig(
max_num_hands=1,
min_detection_confidence=0.7,
box_padding=30,
show_landmarks=True
)
detector = HandDetector(config)
detector.start_detection()
API 文档
HandDetector
手部检测器主类
初始化参数
config:HandDetectorConfig配置对象,可选
方法
start_detection(camera_id=0, show_window=True, window_name='Hand Detection', callback=None): 启动检测detect_single_frame(frame): 检测单帧画面stop_detection(): 停止检测close(): 关闭检测器set_callback(callback): 设置回调函数
HandDetectorConfig
配置类
max_num_hands: 最大检测手数,默认 2min_detection_confidence: 最小检测置信度,默认 0.5min_tracking_confidence: 最小跟踪置信度,默认 0.1box_padding: 边界框内边距,默认 20mirror_frame: 是否镜像画面,默认 Trueshow_landmarks: 是否显示关键点,默认 False
HandDetectionResult
检测结果数据类
hand_index: 手部索引xmin,ymin,xmax,ymax: 边界框坐标confidence: 置信度landmarks: 关键点坐标列表
依赖
- opencv-python >= 4.5.0
- mediapipe >= 0.10.0
许可证
MIT License
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
handind-0.2.0.tar.gz
(9.2 kB
view details)
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 handind-0.2.0.tar.gz.
File metadata
- Download URL: handind-0.2.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2367a580c8322b25692971fd990afe1725fe590c9d1f84e4b9eafa5f4f33d25
|
|
| MD5 |
0eece4b26d2ffba78f7ac14d0939fba0
|
|
| BLAKE2b-256 |
3115d7321e83480c7c12be1f3a897d3be15b043457018226f325eef3c392612a
|
File details
Details for the file handind-0.2.0-py3-none-any.whl.
File metadata
- Download URL: handind-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dcc38a8f32361a0ee2ba0414378bd8f902217f45f0fd43926e7461a7411e26d
|
|
| MD5 |
54c866ba7682910959f59fb8bd2c8f0c
|
|
| BLAKE2b-256 |
4902f9d73904bf2bcfa614e098019f143c07cc518a15b3b90938c5d3f76da10c
|