CollectFaceDataAsync不会调用委托 [英] CollectFaceDataAsync doesn't invoke delegates

查看:87
本文介绍了CollectFaceDataAsync不会调用委托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unity Pro插件FaceModelBuilder没有BeginFaceDataCollection()或GetFaceData()或CollectionCompleted事件。


所以ColectFaceDataAsync是唯一的选择。


我的代码如下:

 public void StartCapture()
{
this.StopFaceCapture();

this.faceModelBuilder = null;

this.faceModelBuilder = this.highDefinitionFaceFrameSource.OpenModelBuilder(FaceModelBuilderAttributes.None);

this.faceModelBuilder.CollectFaceDataAsync((动作< Microsoft.Kinect.Face.FaceModelData>)CollectionSuccess,(动作< INT>)CollectionFailure); // BeginFaceDataCollection();
}




 void CollectionSuccess(FaceModelData modelData)
{
this.currentFaceModel = modelData.ProduceFaceModel();

this.faceModelBuilder.Dispose();
this.faceModelBuilder = null;

this.CurrentBuilderStatus =" Capture Complete" ;;
this.UpdateMesh();
}

但从不调用CollectionSuccess(),即使CheckOnBuilderStatus()给出"完整"

解决方案

永远不会立即调用它,因为它需要不同的面部视图。如果您查看WPF示例,您将看到需要获得左/右/上/下视图才能成功。


您可能希望在更新循环中添加一个检查看的状态是什么:


<预类= "prettyprint">如果(!faceModelBulder = NULL)
{
变种captureStatus = faceModelBuilder.CaptureStatus;

//向用户提供一些反馈。
}


FaceModelBuilder in Unity Pro plugin doesn't have BeginFaceDataCollection() or GetFaceData() or CollectionCompleted event.

so ColectFaceDataAsync is the only option.

my code is like :

public void StartCapture()
	{
		this.StopFaceCapture();
		
		this.faceModelBuilder = null;
		
		this.faceModelBuilder = this.highDefinitionFaceFrameSource.OpenModelBuilder(FaceModelBuilderAttributes.None);
		
		this.faceModelBuilder.CollectFaceDataAsync ((Action<Microsoft.Kinect.Face.FaceModelData>)CollectionSuccess, (Action<int>)CollectionFailure);	   //BeginFaceDataCollection();
	}


void CollectionSuccess(FaceModelData modelData)
	{		
		this.currentFaceModel = modelData.ProduceFaceModel();
		
		this.faceModelBuilder.Dispose();
		this.faceModelBuilder = null;
		
		this.CurrentBuilderStatus = "Capture Complete";
		this.UpdateMesh();
	}

but CollectionSuccess() is never called, even CheckOnBuilderStatus() gives a "Complete"

解决方案

It will never be called immediately as it needs different views of the face. If you review the WPF sample, you will see that you need to get left/right/up/down views until it can succeed.

You may want to put in your update loop a check to see what the state is:

if(faceModelBulder != null)
{
   var captureStatus = faceModelBuilder.CaptureStatus;
   
   // provide some feedback to user.
}


这篇关于CollectFaceDataAsync不会调用委托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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