Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
18d4839
new分支:1.添加.gitignore忽略Lib目录 2.修改main.py优化无人机控制逻辑
xiaoshiyuan888 Dec 18, 2025
99c7bf4
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 18, 2025
dd54e83
改进无人机手势控制系统,优化摄像头处理和手势稳定性
xiaoshiyuan888 Dec 18, 2025
09037fe
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
d1726c9
优化手势识别算法,提升系统稳定性和用户体验
xiaoshiyuan888 Dec 19, 2025
0d155c7
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
fd2edd8
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
4b5e52e
优化英文界面,改进手势识别算法,增强单指识别准确率
xiaoshiyuan888 Dec 19, 2025
5aa3395
Merge branch 'new' of https://github.com/xiaoshiyuan888/nn into new
xiaoshiyuan888 Dec 19, 2025
87eeee6
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
f1897a2
持续优化手势识别算法,解决位置敏感问题,增强全屏手势检测能力
xiaoshiyuan888 Dec 19, 2025
75421ae
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
f095776
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
a7cb67e
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
1c7a07d
优化手势标签显示,修复中文字体缺失导致的问号问题
xiaoshiyuan888 Dec 19, 2025
a499a9b
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
81afe79
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 19, 2025
36f5403
新增:语音反馈系统,支持多平台音频播放
xiaoshiyuan888 Dec 19, 2025
d6aaa05
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 20, 2025
fb866db
优化手势平滑处理,扩展语音反馈系统,增加手势状态追踪
xiaoshiyuan888 Dec 20, 2025
dc19f1c
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 20, 2025
d831140
更新我的项目README.md文件
xiaoshiyuan888 Dec 20, 2025
6a4fd48
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 20, 2025
fcd3d57
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
15eb615
新增手势轨迹记录与回放功能,优化语音反馈系统
xiaoshiyuan888 Dec 21, 2025
86bc6a2
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
9b42799
增加性能模式选择功能
xiaoshiyuan888 Dec 21, 2025
d0e6b06
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
40d100c
增加性能模式选择功能
xiaoshiyuan888 Dec 21, 2025
729daf9
增加性能模式选择功能
xiaoshiyuan888 Dec 21, 2025
a78d784
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
a73dbea
新增完整的性能统计与分析系统,实现实时性能监控、详细报告和系统资源管理功能
xiaoshiyuan888 Dec 21, 2025
3e28176
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
0de8fdf
将手势控制无人机系统拆分为模块化架构,保持功能完整性,优化代码维护性
xiaoshiyuan888 Dec 21, 2025
3621c5b
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
fb9744b
更新我的README文件和依赖文件
xiaoshiyuan888 Dec 21, 2025
50929ae
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 21, 2025
4e9e03b
添加高级手势识别功能,支持旋转、抓取、拍照等复杂手势
xiaoshiyuan888 Dec 21, 2025
fb36875
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 22, 2025
7cb4eca
增加高级飞行控制功能 - 自动飞行模式、圆形盘旋、8字形飞行、高度控制
xiaoshiyuan888 Dec 22, 2025
8fb911a
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 22, 2025
e44a045
优化性能监控:增强分析器+新增UI性能图表
xiaoshiyuan888 Dec 22, 2025
011de6e
Merge branch 'OpenHUTB:main' into new
xiaoshiyuan888 Dec 22, 2025
2d964b7
优化手势识别稳定性,增强性能监控,新增可视化模块
xiaoshiyuan888 Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/autonomus_drone_hand_gesture_project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## 项目简介

基于计算机视觉和语音反馈技术的手势控制无人机系统。使用纯OpenCV实现手部检测和手势识别,结合语音反馈系统,提供直观的无人机控制体验。系统支持AirSim仿真环境和真实无人机控制,具备手势平滑处理、状态追踪、性能监控和轨迹记录等完整功能。
基于计算机视觉和语音反馈技术的手势控制无人机系统。使用OpenCV实现手部检测和手势识别,结合语音反馈系统,提供直观的无人机控制体验。系统支持AirSim仿真环境和真实无人机控制,具备手势平滑处理、状态追踪、性能监控和轨迹记录等完整功能。

## 核心功能

### 1. 增强手势识别与控制
- **纯OpenCV实现**:不依赖深度学习框架,使用肤色检测、轮廓分析和凸缺陷检测识别手势
- **OpenCV实现**:不依赖深度学习框架,使用肤色检测、轮廓分析和凸缺陷检测识别手势
- **多种手势支持**:支持停止、前进、上升、下降、左转、右转、悬停等多种控制手势
- **智能手势平滑**:使用手势稳定性检测和位置平滑算法,减少误判和抖动
- **实时状态追踪**:跟踪手势生命周期(开始/活跃/结束),提供精准控制反馈
Expand Down
222 changes: 219 additions & 3 deletions src/autonomus_drone_hand_gesture_project/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def __init__(self):
'transition_threshold': 0.3,
'position_stability_weight': 0.4,
'gesture_cooldown': 0.5,
# 新增手势稳定性分析配置
'stability_window_size': 15,
'enable_gesture_stability_analysis': True,
},
'drone': {
'velocity': 2.5,
Expand All @@ -111,7 +114,11 @@ def __init__(self):
'show_performance_mode': True,
'show_performance_stats': True,
'show_system_resources': True,
'show_advanced_gestures': True, # 新增:显示高级手势信息
'show_advanced_gestures': True,
# 新增性能可视化配置
'show_performance_visualization': True,
'performance_visualization_mode': 'charts', # 'none', 'charts', 'gauges'
'show_gesture_stability_info': True,
},
'performance': {
'target_fps': 30,
Expand All @@ -122,11 +129,20 @@ def __init__(self):
'modes': ['fast', 'balanced', 'accurate'],
'auto_report_interval': 60,
'enable_performance_monitor': True,
# 新增性能监控配置
'enable_gpu_monitoring': True,
'enable_performance_prediction': True,
'enable_anomaly_detection': True,
'performance_visualization': True,
'detailed_performance_charts': False,
},
'calibration': {
'auto_calibrate_skin': True,
'skin_calibration_frames': 30,
'hand_size_calibration': True
'hand_size_calibration': True,
# 新增自动校准配置
'auto_adjust_parameters': True,
'calibration_interval': 300, # 每5分钟校准一次
},
'speech': {
'enabled': True,
Expand All @@ -144,6 +160,10 @@ def __init__(self):
'min_gesture_confidence': 0.7,
'gesture_start_threshold': 3,
'gesture_end_threshold': 10,
# 新增语音配置
'announce_stability_status': True,
'announce_visualization_changes': True,
'performance_warnings_enabled': True,
},
'recording': {
'auto_save_interval': 5,
Expand All @@ -152,13 +172,46 @@ def __init__(self):
'trajectory_thickness': 2,
'trajectory_max_length': 100,
'default_save_dir': 'trajectories',
# 新增录制配置
'auto_playback_after_recording': False,
'save_compressed_trajectories': True,
'max_auto_save_files': 10,
},
'stability': {
# 新增稳定性分析配置
'enable_stability_analysis': True,
'stability_update_interval': 1.0,
'min_stability_score': 0.6,
'max_transition_count': 10,
'stability_notification_enabled': True,
'auto_reset_on_unstable': True,
},
'visualization': {
# 新增可视化配置
'chart_update_rate': 2, # 每2帧更新一次图表
'gauge_update_rate': 5, # 每5帧更新一次仪表盘
'chart_history_length': 30,
'show_chart_grid': True,
'chart_background_opacity': 0.7,
'performance_colors': {
'excellent': (0, 255, 0),
'good': (100, 255, 100),
'fair': (255, 255, 0),
'poor': (255, 165, 0),
'critical': (255, 0, 0)
}
}
}

self.config = self.load_config()
self.skin_calibration_data = []
self.hand_size_calibration_done = False
self.reference_hand_size = 0

# 新增:可视化状态
self.visualization_enabled = self.get('display', 'show_performance_visualization')
self.visualization_mode = self.get('display', 'performance_visualization_mode')

def load_config(self):
"""加载配置"""
if os.path.exists(self.config_file):
Expand Down Expand Up @@ -217,6 +270,13 @@ def set(self, *keys, value):
config[keys[-1]] = value
self.save_config()

# 更新内部状态
if len(keys) == 2:
if keys[0] == 'display' and keys[1] == 'show_performance_visualization':
self.visualization_enabled = value
elif keys[0] == 'display' and keys[1] == 'performance_visualization_mode':
self.visualization_mode = value

def get_performance_mode_config(self, mode=None):
"""获取性能模式配置"""
if mode is None:
Expand Down Expand Up @@ -311,4 +371,160 @@ def calibrate_hand_size(self, hand_area):
if hand_area > 0:
self.reference_hand_size = hand_area
self.hand_size_calibration_done = True
print(f"✓ 手部大小校准完成: {self.reference_hand_size:.0f} 像素")
print(f"✓ 手部大小校准完成: {self.reference_hand_size:.0f} 像素")

def toggle_visualization_mode(self):
"""切换可视化模式"""
modes = ['none', 'charts', 'gauges']
current_mode = self.get('display', 'performance_visualization_mode')

if current_mode not in modes:
current_mode = 'none'

current_index = modes.index(current_mode)
next_index = (current_index + 1) % len(modes)
next_mode = modes[next_index]

self.set('display', 'performance_visualization_mode', value=next_mode)
self.visualization_mode = next_mode

print(f"✓ 可视化模式切换为: {next_mode}")
return next_mode

def toggle_visualization(self):
"""切换可视化显示"""
current = self.get('display', 'show_performance_visualization')
new_value = not current
self.set('display', 'show_performance_visualization', value=new_value)
self.visualization_enabled = new_value

print(f"✓ 性能可视化: {'开启' if new_value else '关闭'}")
return new_value

def get_visualization_status(self):
"""获取可视化状态"""
return {
'enabled': self.visualization_enabled,
'mode': self.visualization_mode,
'show_chart_grid': self.get('visualization', 'show_chart_grid'),
'chart_background_opacity': self.get('visualization', 'chart_background_opacity')
}

def get_stability_config(self):
"""获取稳定性分析配置"""
return {
'enabled': self.get('stability', 'enable_stability_analysis'),
'window_size': self.get('gesture', 'stability_window_size'),
'update_interval': self.get('stability', 'stability_update_interval'),
'min_score': self.get('stability', 'min_stability_score'),
'auto_reset': self.get('stability', 'auto_reset_on_unstable')
}

def get_visualization_config(self):
"""获取可视化配置"""
return {
'chart_update_rate': self.get('visualization', 'chart_update_rate'),
'gauge_update_rate': self.get('visualization', 'gauge_update_rate'),
'chart_history_length': self.get('visualization', 'chart_history_length'),
'show_grid': self.get('visualization', 'show_chart_grid'),
'background_opacity': self.get('visualization', 'chart_background_opacity'),
'colors': self.get('visualization', 'performance_colors')
}

def validate_config(self):
"""验证配置有效性"""
issues = []

# 检查性能模式
current_mode = self.get('performance', 'mode')
if current_mode not in self.performance_modes:
issues.append(f"无效的性能模式: {current_mode}")
self.set('performance', 'mode', value='balanced')

# 检查可视化模式
viz_mode = self.get('display', 'performance_visualization_mode')
valid_viz_modes = ['none', 'charts', 'gauges']
if viz_mode not in valid_viz_modes:
issues.append(f"无效的可视化模式: {viz_mode}")
self.set('display', 'performance_visualization_mode', value='charts')

# 检查手势稳定性窗口大小
window_size = self.get('gesture', 'stability_window_size')
if not isinstance(window_size, int) or window_size < 5 or window_size > 50:
issues.append(f"无效的手势稳定性窗口大小: {window_size}")
self.set('gesture', 'stability_window_size', value=15)

if issues:
print("⚠ 配置验证发现问题:")
for issue in issues:
print(f" - {issue}")
print("✓ 已自动修复配置问题")

return len(issues) == 0

def reset_to_defaults(self, section=None):
"""重置配置为默认值"""
if section is None:
self.config = self.default_config.copy()
print("✓ 所有配置已重置为默认值")
elif section in self.default_config:
self.config[section] = self.default_config[section].copy()
print(f"✓ {section} 配置已重置为默认值")
else:
print(f"⚠ 无效的配置节: {section}")
return False

self.save_config()
return True

def export_config(self, filename=None):
"""导出配置到文件"""
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
if filename is None:
timestamp = time.strftime("%Y%m%d_%H%M%S")
filename = os.path.join(current_dir, f'gesture_config_backup_{timestamp}.json')

try:
with open(filename, 'w', encoding='utf-8') as f:
json.dump(self.config, f, indent=2, ensure_ascii=False)
print(f"📤 配置已导出到: {filename}")
return True
except Exception as e:
print(f"❌ 导出配置失败: {e}")
return False

def import_config(self, filename):
"""从文件导入配置"""
try:
if not os.path.exists(filename):
print(f"❌ 配置文件不存在: {filename}")
return False

with open(filename, 'r', encoding='utf-8') as f:
loaded_config = json.load(f)

# 合并配置
self._merge_config(self.config, loaded_config)
self.save_config()

print(f"📥 配置已从文件导入: {filename}")
return True
except Exception as e:
print(f"❌ 导入配置失败: {e}")
return False

# 用于测试配置管理器
if __name__ == "__main__":
import time

config = ConfigManager()

print("当前配置状态:")
print(f" 性能模式: {config.get('performance', 'mode')}")
print(f" 可视化模式: {config.get('display', 'performance_visualization_mode')}")
print(f" 手势稳定性分析: {config.get('gesture', 'enable_gesture_stability_analysis')}")
print(f" GPU监控: {config.get('performance', 'enable_gpu_monitoring')}")

# 验证配置
config.validate_config()
Loading
Loading