如何同时使用GetDefaultKinectSensor和GetKinectCoreWindowForCurrentThread? [英] how to use GetDefaultKinectSensor and GetKinectCoreWindowForCurrentThread same time??

查看:386
本文介绍了如何同时使用GetDefaultKinectSensor和GetKinectCoreWindowForCurrentThread?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


我使用IkenctCoreWindow界面,但我不知道如何使用它


你可以帮助我吗?

 HRESULT hr; 

hr = GetDefaultKinectSensor(& m_pKinectSensor);

if(FAILED(hr))
{
return hr;
}

hr = GetKinectCoreWindowForCurrentThread(& m_pKinectCoreWindow);

if(FAILED(hr))
{
return hr;
}


if(m_pKinectSensor)
{
//初始化Kinect并获取坐标映射器和body读取器
IBodyFrameSource * pBodyFrameSource = NULL;

if(SUCCEEDED(hr))
{
hr = m_pKinectCoreWindow-> SubscribePointerMoved(& m_pHandle);
}

if(SUCCEEDED(hr))
{
hr = m_pKinectCoreWindow-> GetPointerMovedEventData(m_pHandle,& m_pKinectEventArgs);
}

hr = m_pKinectSensor-> Open();

if(SUCCEEDED(hr))
{
hr = m_pKinectSensor-> get_CoordinateMapper(& m_pCoordinateMapper);
}

if(SUCCEEDED(hr))
{
hr = m_pKinectSensor-> get_BodyFrameSource(& pBodyFrameSource);
}

if(SUCCEEDED(hr))
{
hr = pBodyFrameSource-> OpenReader(& m_pBodyFrameReader);
}

SafeRelease(pBodyFrameSource);
}

if(!m_pKinectSensor || FAILED(hr))
{
SetStatusMessage(L"未找到现成的Kinect!",10000,true);
返回E_FAIL;
}

返回小时;

解决方案

你想做什么?您尝试运行此代码的过程是否具有消息泵/ UI?你得到了什么样的错误?


GetDefaultKinectSensor - 从SDK中获取默认传感器。这必须由任何Kinect应用程序调用以从运行时获取传感器对象


GetKinectCoreWindowForCurrentThread  - 返回一个可以接受Kinect输入事件的窗口对象


https://msdn.microsoft.com/en-us/library /microsoft.kinect.kinect.ikinectcorewindow.aspx


hi

im use IkenctCoreWindow Interface but i dont know how to use it

could you help me?

HRESULT hr;
	
    hr = GetDefaultKinectSensor(&m_pKinectSensor);

    if (FAILED(hr))
    {
        return hr;
    }

	hr = GetKinectCoreWindowForCurrentThread(&m_pKinectCoreWindow);

	if (FAILED(hr))
	{
		return hr;
	}

		
    if (m_pKinectSensor)
    {
        // Initialize the Kinect and get coordinate mapper and the body reader
        IBodyFrameSource* pBodyFrameSource = NULL;

		if (SUCCEEDED(hr))
		{
			hr = m_pKinectCoreWindow->SubscribePointerMoved(&m_pHandle);
		}

		if (SUCCEEDED(hr))
		{
			hr = m_pKinectCoreWindow->GetPointerMovedEventData(m_pHandle, &m_pKinectEventArgs);
		}

        hr = m_pKinectSensor->Open();

        if (SUCCEEDED(hr))
        {
            hr = m_pKinectSensor->get_CoordinateMapper(&m_pCoordinateMapper);
        }

        if (SUCCEEDED(hr))
        {
            hr = m_pKinectSensor->get_BodyFrameSource(&pBodyFrameSource);
        }

        if (SUCCEEDED(hr))
        {
            hr = pBodyFrameSource->OpenReader(&m_pBodyFrameReader);
        }

        SafeRelease(pBodyFrameSource);
    }

    if (!m_pKinectSensor || FAILED(hr))
    {
        SetStatusMessage(L"No ready Kinect found!", 10000, true);
        return E_FAIL;
    }

    return hr;

解决方案

What are you trying to do? Does the process you are trying to run this code from have a message pump/UI? What kind of errors are you getting?

GetDefaultKinectSensor - gets the default sensor from the SDK. This must be called by any Kinect application to get the sensor object from the runtime

GetKinectCoreWindowForCurrentThread - returns a window object that can accept input events for Kinect

https://msdn.microsoft.com/en-us/library/microsoft.kinect.kinect.ikinectcorewindow.aspx


这篇关于如何同时使用GetDefaultKinectSensor和GetKinectCoreWindowForCurrentThread?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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