Skip to main content

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: 最大检测手数,默认 2
  • min_detection_confidence: 最小检测置信度,默认 0.5
  • min_tracking_confidence: 最小跟踪置信度,默认 0.1
  • box_padding: 边界框内边距,默认 20
  • mirror_frame: 是否镜像画面,默认 True
  • show_landmarks: 是否显示关键点,默认 False

HandDetectionResult

检测结果数据类

  • hand_index: 手部索引
  • xmin, ymin, xmax, ymax: 边界框坐标
  • confidence: 置信度
  • landmarks: 关键点坐标列表

依赖

  • opencv-python >= 4.5.0
  • mediapipe >= 0.10.0

许可证

MIT License

Metadata

Release files for handind 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for handind 0.2.0
File Size Uploaded Provenance Actions
handind-0.2.0.tar.gz 9.2 kB Without provenance Details for handind-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for handind 0.2.0
File Interpreter ABI Platform Actions
handind-0.2.0-py3-none-any.whl Python 3 none any Details for handind-0.2.0-py3-none-any.whl

Total release size: 18.5 kB

Release files / handind-0.2.0.tar.gz

Download URL handind-0.2.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f2367a580c8322b25692971fd990afe1725fe590c9d1f84e4b9eafa5f4f33d25
BLAKE2b-256 checksum
How to use checksums
3115d7321e83480c7c12be1f3a897d3be15b043457018226f325eef3c392612a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / handind-0.2.0-py3-none-any.whl

Download URL handind-0.2.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dcc38a8f32361a0ee2ba0414378bd8f902217f45f0fd43926e7461a7411e26d
BLAKE2b-256 checksum
How to use checksums
4902f9d73904bf2bcfa614e098019f143c07cc518a15b3b90938c5d3f76da10c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Security for handind 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page