当前位置: 首页 > 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.hskmm.com/?act=detail&tid=18020

相关文章:

  • 暴力拓客游戏小程序:助力商家高效引流与裂变的智能解决方案
  • vue3小坑之-为什么把ref定义的数组赋值给数组对象后取值为空数组?
  • 第二类斯特林数
  • 群论
  • 扫码签到赢大奖小程序:助力多场景获客的智能营销工具
  • docker 镜像/容器
  • jmeter命令行参数详细解释
  • RK3399:性能与能效的嵌入式先锋,解锁多场景应用潜力
  • 【C++STL详解】带头双向循环结构 + 双向迭代器,核心接口 + 排序效率 + 避坑指南 - 教程
  • TorchV知识库安全解决方案:基于智能环境感知的动态权限控制
  • VBA ETH功能应用 | “0”代码构建SOME/IP节点
  • ISUP协议视频平台EasyCVR在智慧灯杆综合管理中的应用
  • 视觉智能赋能产业数智化升级:JBoltAI多模态技术落地实践
  • 神秘考试题
  • 华三交换机升级版本步骤
  • Solon v3.4.6, v3.5.4, v3.6.0-M1 发布。正式开始 LTS 计划
  • 串口通信、阻塞与非阻塞、qt
  • 破解 Java 系统 AI 化难题:JBoltAI 框架自带 RAG、Function Calling 核心功能
  • 算法第一章作业
  • CF1706E Qpwoeirut and Vertices
  • 聚焦 Java AI 开发:JBoltAI 框架支持多模型适配,打造智能应用
  • 企业级 AI 应用开发首选!JBoltAI 框架适配 Java 技术栈,稳定可靠
  • 别等碳超支才慌!EMS 像 “碳导航”,提前预警能耗 “堵点”,双碳路上不绕路
  • OTA测试实战指南:测试流程、用例设计与自动化实现
  • Halcon图像——相机图像采集模式
  • How to use SQL Server Management Studio track one store procedure performance - 详解
  • 【2025-09-25】连岳摘抄
  • 完整教程:探索 Event 框架实战指南:微服务系统中的事件驱动通信:
  • Gitee:本土化DevOps平台如何助力企业实现研发效能跃迁
  • 全新升级~山海鲸4.5.12版本更新内容速递