Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
852109a
完成选题并提交
jiangyi2302 Dec 18, 2025
6fe47f5
完成选题并提交
jiangyi2302 Dec 18, 2025
af14f99
完成选题并提交
jiangyi2302 Dec 18, 2025
c1ae4ac
完成选题并提交
jiangyi2302 Dec 18, 2025
ddaa9d5
完成选题并提交
jiangyi2302 Dec 18, 2025
d66962d
完成选题并提交
jiangyi2302 Dec 18, 2025
9293e17
完成选题并提交
jiangyi2302 Dec 18, 2025
e8fef31
完成选题并提交
jiangyi2302 Dec 18, 2025
7a9fab5
完成选题并提交
jiangyi2302 Dec 18, 2025
79cc531
完成选题并提交
jiangyi2302 Dec 18, 2025
29f7770
完成选题并提交
jiangyi2302 Dec 18, 2025
4b1aca1
完成选题并提交
jiangyi2302 Dec 18, 2025
edcd60e
完成选题并提交
jiangyi2302 Dec 18, 2025
e43731a
完成选题并提交
jiangyi2302 Dec 18, 2025
0f8575a
完成选题并提交
jiangyi2302 Dec 18, 2025
60db4b4
完成选题并提交
jiangyi2302 Dec 18, 2025
d9535ba
完成选题并提交
jiangyi2302 Dec 18, 2025
7886980
完成选题:更新Unmanned_Aircraft_System的README.md
jiangyi2302 Dec 18, 2025
b498537
提交选题
jiangyi2302 Dec 19, 2025
bc14972
修改选题
jiangyi2302 Dec 19, 2025
c0679cb
完成选题并提交
jiangyi2302 Dec 19, 2025
2d1e296
重命名文件夹:Unmanned_Aircraft_System → UAV_Small_Target_Recognition
jiangyi2302 Dec 19, 2025
d49e121
完成选题并提交
jiangyi2302 Dec 19, 2025
2c57293
重命名文件夹为Gesture_Control_for_Airsim_UAV,并更新README.md补充无人机手势控制内容
jiangyi2302 Dec 19, 2025
d5f2c9d
重命名文件夹:Gesture_Control_for_Airsim_UAV → Drone_gesture_operation
jiangyi2302 Dec 19, 2025
f1d3167
更新Drone_gesture_operation/README.md:基于轻量级 CNN 的无人机手势操控指令识别
jiangyi2302 Dec 19, 2025
5a5639c
无人机手势识别
jiangyi2302 Dec 20, 2025
0ecd007
更新Drone_gesture_operation:同步main.py代码
jiangyi2302 Dec 20, 2025
786c598
无人机手势识别
jiangyi2302 Dec 20, 2025
2bd5954
优化Drone_gesture_operation/main.py:给代码添加注释,增加可读性
jiangyi2302 Dec 20, 2025
c6eea87
新增Drone_gesture_operation/keypoint_classifier.py:无人机手势关键点分类器
jiangyi2302 Dec 21, 2025
f2dc1af
优化Drone_gesture_operation/main.py:可切换三种模式
jiangyi2302 Dec 21, 2025
0b9f52d
给代码添加注释
jiangyi2302 Dec 22, 2025
049d707
能够识别手势:拳头
jiangyi2302 Dec 22, 2025
d5a28cd
优化手势切换的流畅度
jiangyi2302 Dec 22, 2025
b966120
Merge branch 'main' into main
jiangyi2302 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
1 change: 0 additions & 1 deletion src/Drone_gesture_operation/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
基于轻量级 CNN 的无人机手势操控指令识别

65 changes: 65 additions & 0 deletions src/Drone_gesture_operation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
import cv2 as cv
import numpy as np
import time


# 极简手势识别(仅保留拳头/点手势,极致流畅)
def main():
# 1. 摄像头初始化(极简参数)
cap = cv.VideoCapture(0)
cap.set(cv.CAP_PROP_FRAME_WIDTH, 320) # 极低分辨率,秒杀卡顿
cap.set(cv.CAP_PROP_FRAME_HEIGHT, 240)
cap.set(cv.CAP_PROP_FOURCC, cv.VideoWriter_fourcc(*'MJPG')) # 快速编码
cap.set(cv.CAP_PROP_BUFFERSIZE, 1) # 关闭缓存,降低延迟

# 2. 固定参数(适配所有摄像头)
skin_lower = np.array([0, 10, 10], np.uint8)
skin_upper = np.array([30, 255, 180], np.uint8)
kernel = np.ones((3, 3), np.uint8)
last_gesture = "None"
gesture_count = 0

print("✅ 极致轻量化手势识别 | ESC退出")
print("💡 把手放在画面中间,握拳=Fist,伸食指=Point")

while True:
# 计时(极简FPS)
t1 = time.time()

# 3. 读取帧(跳过缓存帧)
from collections import deque


Expand Down Expand Up @@ -80,6 +106,45 @@ def main():
if not ret:
break
frame = cv.flip(frame, 1)
frame_small = cv.resize(frame, (160, 120)) # 超小尺寸处理

# 4. 极简手部检测
hsv = cv.cvtColor(frame_small, cv.COLOR_BGR2HSV)
mask = cv.inRange(hsv, skin_lower, skin_upper)
mask = cv.morphologyEx(mask, cv.MORPH_OPEN, kernel)

# 5. 找轮廓(只找最大的)
contours, _ = cv.findContours(mask, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)
current_gesture = "None"
if contours:
cnt = max(contours, key=cv.contourArea)
if cv.contourArea(cnt) > 1000:
# 6. 极简分类(仅拳头/点手势)
hull = cv.convexHull(cnt)
solidity = cv.contourArea(cnt) / cv.contourArea(hull)
current_gesture = "Fist" if solidity > 0.85 else "Point"

# 7. 稳定输出(连续2帧相同)
if current_gesture == last_gesture:
gesture_count += 1
else:
gesture_count = 0
last_gesture = current_gesture
stable_gesture = last_gesture if gesture_count > 1 else "None"

# 8. 绘制(极简UI,减少计算)
cv.putText(frame, f"Gesture: {stable_gesture}", (10, 30),
cv.FONT_HERSHEY_SIMPLEX, 1.0, (0, 0, 255), 2)
cv.putText(frame, f"FPS: {int(1 / (time.time() - t1))}", (10, 60),
cv.FONT_HERSHEY_SIMPLEX, 0.8, (255, 0, 0), 2)

# 9. 显示(拉伸回原尺寸,保持清晰)
frame_show = cv.resize(frame, (640, 480))
cv.imshow("Ultra Light Gesture", frame_show)

if cv.waitKey(1) & 0xFF == 27:
break

debug_frame = frame.copy()

# 1. 绘制ROI框(提示用户把手放在这里)
Expand Down
Loading