Kinect应用程序运行片刻然后错误 [英] Kinect application runs a moment then bugs

查看:76
本文介绍了Kinect应用程序运行片刻然后错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好, 

 

我正在使用Kinect SDK 1.7开发一个应用程序,我想实现一个跌倒检测算法。

基于关节坐标,我必须计算最大值和确定3D边界
框的2维(H和WD)的所有关节中的最小值。


 

我首先将帧速率降低到15FPS(在KinectSensorOnAllFramesReady事件中),然后处理帧以保存关节坐标并计算
H和WD。

这里是我所做的代码。

List Hlist = new List();
List WDlist = new List();
List JlistX = new List();
List JlistY = new List();
List JlistZ = new List();
static int framesCounter = 0;
public MainWindow()
{
// other process
 
private void KinectSensorOnAllFramesReady(object sender, AllFramesReadyEventArgs allFramesReadyEventArgs)
{

framesCounter = framesCounter++ % 2; // 2 is the divisor to work with 15 FPS
 
if (framesCounter == 0)
{
// other process to manipulate depth images
 

Skeleton first = GetFirstSkeleton(allFramesReadyEventArgs);
 
if (first == null) // s'il n y pas de squeulette 
{
txtP.Text = "No Person detected"; // Idle mode)
return;
}
 
if (first.TrackingState == SkeletonTrackingState.Tracked)
{
txtP.Text = "A person is detected";

save_joints(first);

 
}
 
}
}
//************************************************************************************************************
 
// Save and display joints coordinates
 
//************************************************************************************************************
///

/// method to save and display joints coordinates detected in a list
///

/// 
/// 
private void save_joints(Skeleton first)
{

foreach (Joint joint in first.Joints)
{
float jx = joint.Position.X;
float jy = joint.Position.Y;
float jz = joint.Position.Z;
JlistX.Add(jx);
JlistY.Add(jy);
JlistZ.Add(jz);
}
 
JlistX.Sort();
JlistY.Sort();
JlistZ.Sort();
float xMin = JlistX[0];
float xMax = JlistX[JlistX.Count - 1];
float yMin = JlistY[0];
float yMax = JlistY[JlistY.Count - 1];
float zMin = JlistZ[0];
float zMax = JlistZ[JlistZ.Count - 1];

float W = System.Math.Abs(xMin - xMax);
float H = System.Math.Abs(yMin - yMax);
float D = System.Math.Abs(zMin - zMax);
double WD = System.Math.Sqrt(Math.Pow(W, 2) + Math.Pow(D, 2));
Hlist.Add(H);
 
//WDlist.Add(WD);
 
//***********************************************************************//
// //
// display min et max //
// //
//***********************************************************************//

xmax.Text = xMax.ToString();
ymax.Text = yMax.ToString();
zmax.Text = zMax.ToString();
xmin.Text = xMin.ToString();
zmin.Text = zMin.ToString();
ymin.Text = yMin.ToString();
dimH.Text = H.ToString();
dimWD.Text = WD.ToString();

 

 
//*************************************************************************************************************************//
}

运行代码时,有mani问题:

1 / zmin始终为0 ..

2 /应用程序运行片刻,我可以看到最大值和最小值发生变化,然后在我继续移动并做出手势时保持固定。

3 / Hlist总是只有一个我不理解的值。

 

任何人都可以帮助我吗? 

我被困在这里一段时间,看不出错误在哪里!

感谢您的帮助

DKF

推荐答案

zmin为0,因为并非所有关节都被跟踪或者有一些可能有意义的质量测量。关节可以被遮挡或推断。查看骨架基础代码以检查骨架关节对象的各种属性。

zmin is 0 because not all joints are tracked or have some quality measurement that might make sense. Joints can be occluded or inferred. Review the skeleton basics code to check various properties of the skeleton joint object.

逐步执行代码并仔细分析每个关节并确定您获得的值以及是否需要将这些值包含在您的算法中。

step through your code and closely analyze each joint and determine what values you are getting and whether these need to be included in your algorithm.

您是否正确遵循该模式复制数据和释放帧。你的函数被调用了多少次。如果你只从运行时获得一帧,那就是你只有一个条目的原因。

Are you correctly following the pattern of copying the data and releasing frames. How many times is your function getting called. If you are only getting one frame from the runtime, that would be why you only have one entry.


这篇关于Kinect应用程序运行片刻然后错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆