Apache License 2.0

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

深度技术分析:takeyamayuki/NonMouse 项目

项目背景与痛点

在日常办公或游戏中,鼠标是不可或缺的输入设备,但手部的大幅度移动和点击操作往往会造成疲劳。takeyamayuki/NonMouse 项目旨在通过一个简单的、基于摄像头的虚拟手势鼠标来解决这一问题。非接触式的操作方式不仅能够减轻手部的负担,还能够在多种应用场景中实现更高效的工作模式。用户无需任何额外设备,只需使用现有的桌面摄像头即可实现手势交互。该方案让原本固定在桌面上的手部活动起来,解决了长时间使用鼠标造成的不适和疲劳问题,从而提高工作效率和舒适度。

核心技术揭秘

非鼠标系统(NonMouse)采用了先进的机器学习算法和计算机视觉技术,通过捕捉用户的手部运动并将其转换为鼠标操作,而无需接触实际的鼠标设备。以下是核心技术的实现细节:

技术栈与设计模式

技术栈:

  • OpenCV:用于图像捕获和处理。
  • TensorFlow 或 PyTorch:用于训练和实施深度学习模型,实现手势识别。

设计模式:

  • 观察者模式:摄像头捕获数据后,发送给多个处理器节点进行分析。
  • 单体架构:简化部署,便于维护和扩展。

数据流图

以下Mermaid图示意了整体数据流:

graph TD A[摄像头发射] B[图像捕获] C[预处理] D{"手势识别?"} E[鼠标控制] F[手势未识别] G[异常处理] A --> B B --> C C --> D D -->|是| E D -->|否| F F --> G

在系统运行时,摄像头捕捉的每一帧图像首先通过 OpenCV 进行预处理以去除噪声和背景干扰。预处理后的图像随后被送入训练好的深度学习模型进行手势识别。识别出的手势将根据预定义的映射规则转化为相应的鼠标操作,并反馈至系统层执行。而未能识别的手势则会被标记出来,随系统运行进行异常处理。

实现原理

手势识别依赖于深度神经网路模型识别用户的手势。通过大量的图像数据训练模型,以提高准确度。实际使用中,手指的上、下、左或右移动,以及手的打开和闭合状态,被映射为相应的增、减、X轴移动、Y轴移动以及鼠标点击操作。手势识别模型可优化为实时响应,达到与传统鼠标相同的交互体验。

功能亮点与差异

相较于市面上现有的手势识别产品,NonMouse 的优势在于使用门槛低,仅需一台普通台式机及内置摄像头,无须额外硬件,降低用户的初期投入和维护成本。此外,它在优化上手难度的同时保持高度的个性化和高度可定制的交互模式。例如,用户可以方便地自定义手势与鼠标操作之间的映射规则,使手势识别更加符合个人习惯和需求。

应用场景与落地建议

在生产环境中,用户应当确保摄像头拥有对用户手部清晰的视野,没有严重遮挡或外界光源的干扰。该系统更适合桌面办公环境,如日常办公、数据处理等,减少长时间控制鼠标的疲劳。此外,虚拟现实、在线教育等领域也可见其应用前景,提供一种非接触式教学手段或互动方式,更加符合未来远程办公的趋势。

综合评价

优点:

  • 基于普通摄像头的便捷性,部署与维护无需额外硬件成本。
  • 高度可定制的交互模式,提升用户个性化体验。
  • 实时响应速度和低学习成本,能够满足普通用户的需求。

缺点:

  • 手势识别的准确性容易受光照变化的影响,需要一定的使用场景适应。
  • 用户适应新型鼠标控制方式可能需要一定时间,毕竟并非所有用户都擅长利用手势控制。
  • 实时完整的手势识别仍是一个计算密集型任务,对于硬件配置有一定的基本要求。

关于

GitHub 原始描述(英文)

a webcam-based virtual gesture mouse that is easy to use with hands on the desk.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
249
价值分
127
活跃状态
活跃

语言占比

CSS
JavaScript
Python
TypeScript

Release

贡献者

README

a webcam-based virtual gesture mouse that is easy to use with hands on the desk


Features

  • No need for anything other than a webcam and host PC.
  • Gesture-based HCI has been around for some time, but shooting from above makes the mouse easier to use.
  • NonMouse can be invoked by the global hotkey even when this application is inactive.
  • Works well with typing.
  • Just download from the latest release(windows, mac only).

Installation

📁 Executable file

Download the zip file that matches your environment from the latest release.

OR

🐍 PyPI

Run the following script.

$ pip install nonmouse

(If you have trouble installing mediapipe, please visit the official website.)

Usage

1. Install a camera

The following three ways of placing the device are assumed.

  • Normal: Place a webcam normally and point it at yourself (or use your laptop’s built-in camera)

    スクリーンショット 2021-09-13 午後5 33 21 スクリーンショット 2021-09-13 午後5 33 21
  • Above: Place it above your hand and point it towards your hand.

    スクリーンショット 2021-09-13 午後5 33 21 スクリーンショット 2021-09-13 午後5 33 21
  • Behind: Place it behind you and point it at the display.

    スクリーンショット 2021-09-13 午後5 33 21 スクリーンショット 2021-09-13 午後5 33 21

2. Run

  • Run the executable as described in the GitHub wiki.

    OR

  • Run the following script from the continuation of the installation.

    For windows and linux(global hotkey function does not work in linux.)

    $ nonmouse
    

    For MacOS, you need execute permission.

    $ sudo nonmouse
    

3. Settings

When you run the program, You will see a screen similar to the following. On this screen, you can set the camera and sensitivity.

スクリーンショット 2021-12-02 154251

  • Camera
    Select a camera device. If multiple cameras are connected, try them in order, starting with the smallest number.

  • How to place
    Select the location where you placed the camera. Place the camera in one of the following positions: Normal, Above, Behind in [📷 Install a Camera].

  • Sensitivity
    Set the sensitivity. If set too high, the mouse cursor will shake slightly.

When you are done with the settings, click continue. The camera image will then be displayed, and you can use NonMouse with the settings you selected.

4. Hand Movements

stop cursor left click right click scroll
aaa aaa aaa aaa

The following hand movements are enabled only when you hold down Alt(Windows), Command(MacOS). You can define your own global hotkeys by rewriting here. You can use this function even if the window is not active.This feature is only available on windows and mac.

  • cursor
    • Mouse cursor: tip of index finger → A blue circle will appear at the tip of your index finger.
    • Stop mouse cursor: Attach the tip of your index finger to the tip of your middle finger. → The blue circle disappears.
  • left click
    • Left click: Attach the fingertips of your thumb to the second joint of your index finger → A yellow circle will appear on the tip of your index finger.
    • Left click release: Release the thumb fingertip and the second joint of the index finger. → The yellow circle disappears.
    • Double click: Left click twice within 0.5 seconds.
  • other
    • Right click: Hold the click state for 1.5 second without moving the cursor. → A red circle will appear at the tip of your index finger.
    • Scroll: Scroll with the index finger with the index finger folded → a black circle will appear.

Note

  • Use it with a bright light at hand.
  • Keep your hand as straight as possible to the camera.

5. Quit

Press Ctrl+C, when a terminal window is active.
Press close button(Valid only on windows, linux) or Esc key, when an application window is active.

Build

Note
The built binary files can be downloaded from latest realease.

In app-mac.spec and app-win.spec, change pathex to fit your environment.
Run the following scripts for each OS.

  • windows

    Copy and paste the location obtained by pip show mediapipe into datas, referring to what is written originally.
    Run the following script.

    $ pip show mediapipe
    ...
    Location: c:\users\namik\appdata\local\programs\python\python37\lib\site_packages
    ...
    #Copy and paste into the datas in win.spec
    $ pyinstaller config/win.spec
    ... ````
    
  • mac

    Create a venv environment and perform pip install, because the directory specified in datas is for an assumed venv environment.

    $ git clone https://github.com/takeyamayuki/NonMouse.git
    $ cd NonMouse
    $ python3 -m venv venv
    $ . venv/bin/activate
    (venv)$ pip install -r requirements.txt
    (venv)$ pyinstaller config/mac.spec
    

评论

暂无评论