当前位置: 首页 > news >正文

Kinect屏幕边缘检测不灵敏的解决方案


在做体感项目时,在边缘部分的抓取动作识别非常差
于是我做出了优化,不采用原本的映射关系:
假设原本人物站在中间,保持位置不动,右手臂向右伸直,终点为屏幕的极限位置
此时我们并不将手臂伸直的位置映射到屏幕的极限位置,而是映射到屏幕的120%处,如此一来,原设备检测的区域就变为了20%——80%之间,保证了一定的精度

 

            Rect rectCanvas = LeftCursor.canvas.pixelRect;float xoffset = (rectCanvas.width) / 2;float yoffset = rectCanvas.height / 2;float multiple = 2f;Vector3 posSprite = new Vector2(Mathf.Clamp(multiple * (leftHandScreenPos.x * rectCanvas.width - xoffset) ,- xoffset,xoffset) , Mathf.Clamp(multiple*(leftHandScreenPos.y * rectCanvas.height - yoffset),-yoffset,yoffset) );Vector3 posSprite1 = new Vector2(Mathf.Clamp(multiple * (rightHandScreenPos.x * rectCanvas.width - xoffset), -xoffset, xoffset),Mathf.Clamp(multiple*(rightHandScreenPos.y * rectCanvas.height - yoffset),-yoffset,yoffset) );

此外,还可以使用List<Vector3>来存储历史数据,然后在每次更新时计算平均值,获得更稳定的位置更新。

 

    // 存储关节历史数据,用于平滑private readonly Queue<Vector3> LefthandData = new Queue<Vector3>();private readonly Queue<Vector3> RighthandData = new Queue<Vector3>();/// <summary>/// 设置空间坐标/// </summary>private void ScreenSetting(){if (interactionManager!=null){leftHandScreenPos = interactionManager.GetLeftHandScreenPos();rightHandScreenPos = interactionManager.GetRightHandScreenPos();Rect rectCanvas = LeftCursor.canvas.pixelRect;float xoffset = (rectCanvas.width) / 2;float yoffset = rectCanvas.height / 2;float multiple = 2f;Vector3 posSprite = new Vector2(Mathf.Clamp(multiple * (leftHandScreenPos.x * rectCanvas.width - xoffset) ,- xoffset,xoffset) , Mathf.Clamp(multiple*(leftHandScreenPos.y * rectCanvas.height - yoffset),-yoffset,yoffset) );Vector3 posSprite1 = new Vector2(Mathf.Clamp(multiple * (rightHandScreenPos.x * rectCanvas.width - xoffset), -xoffset, 
xoffset),Mathf.Clamp(multiple*(rightHandScreenPos.y * rectCanvas.height - yoffset),-yoffset,yoffset) );if (!isLerp){if (LefthandData.Count < 20){LefthandData.Enqueue(posSprite);}else{LefthandData.Dequeue();LefthandData.Enqueue(posSprite);}if (RighthandData.Count < 20){RighthandData.Enqueue(posSprite1);}else{RighthandData.Dequeue();RighthandData.Enqueue(posSprite1);}LeftCursor.transform.GetComponent<RectTransform>().anchoredPosition = new Vector3(LefthandData.Average(item => item.x), LefthandData.Average(item => item.y), LefthandData.Average(item => item.z));if (BothHand){RightCursor.transform.GetComponent<RectTransform>().anchoredPosition = new Vector3(RighthandData.Average(item => item.x), RighthandData.Average(item => item.y), RighthandData.Average(item => item.z));}}else{LeftCursor.transform.GetComponent<RectTransform>().anchoredPosition = Vector3.Lerp(LeftCursor.transform.GetComponent<RectTransform>().anchoredPosition, posSprite, Time.deltaTime * 10);if (BothHand){RightCursor.transform.GetComponent<RectTransform>().anchoredPosition = Vector3.Lerp(RightCursor.transform.GetComponent<RectTransform>().anchoredPosition, posSprite1, Time.deltaTime * 10); ;}}}}

 

http://www.rkmt.cn/news/12286.html

相关文章:

  • RK3399:性能与能效的嵌入式先锋,解锁多场景应用潜力
  • Node.js后端学习笔记:Express+MySQL - 指南
  • TorchV知识库安全解决方案:基于智能环境感知的动态权限控制
  • 详细介绍:Java HTTP协议(二)--- HTTPS,Tomcat
  • Solon v3.4.6, v3.5.4, v3.6.0-M1 发布。正式开始 LTS 计划
  • 串口通信、阻塞与非阻塞、qt
  • 破解 Java 系统 AI 化难题:JBoltAI 框架自带 RAG、Function Calling 核心功能
  • CF1706E Qpwoeirut and Vertices
  • Prometheus-01-框架架构与核心概念详解
  • OTA测试实战指南:测试流程、用例设计与自动化实现
  • How to use SQL Server Management Studio track one store procedure performance - 详解
  • 【2025-09-25】连岳摘抄
  • activiti部署流程后act_re_procdef表中无流程定义信息
  • 手写代码使用Fls模块的方法
  • OpenCSG斩获第四届琶洲算法大赛开源领域第一
  • 在阅读中测试用户的词汇掌握情况
  • 【译】Visual Studio 中针对 .NET MAUI 的 XAML 实时预览功能的增强
  • 在CodeBolcks下wxSmith的C++编程教程——键盘输入和显示结果
  • 幽冥大陆(七)安诺克酒店智能门锁SDKV3 VBDemo—东方仙盟 - 教程
  • 实用指南:黄金价格小工具抖音快手微信小程序看广告流量主开源
  • 20250725_QQ_ezusb
  • .netcore 程序启动时的核心类 - 指南
  • HP激光墨盒换墨粉
  • 详细介绍:《 Linux 点滴漫谈: 一 》开源之路:Linux 的历史、演进与未来趋势
  • 深入解析:P4779 【模板】单源最短路径(标准版)
  • [更新完毕]2025华为杯B题数学建模研赛B题研究生数学建模思路代码文章成品:无线通信系统链路速率建模 - 指南
  • redis-bitMap类型基本命令
  • 基于SpringBoot及PostgreSQL的国家减肥食谱管理项目(上):区域与省份安装搭建
  • 基于BP神经网络的激光焊接数据预测
  • Pandawiki:企业知识管理的全能管家