none
how to use GetDefaultKinectSensor and GetKinectCoreWindowForCurrentThread same time?? RRS feed

  • Question

  • 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;

    Monday, January 26, 2015 12:59 AM

All replies

  • 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


    Carmine Sirignano - MSFT

    Monday, January 26, 2015 7:22 PM
  • I need to make a custom cursor in kinect v2 but i don't know to start i need to make it using C++

    like "house of cursors" in K4V2 Jumpstar(7)

    Can a link be provided to get this sample code?

    thanks


    • Edited by junho_e Tuesday, January 27, 2015 2:39 AM
    Tuesday, January 27, 2015 12:36 AM
  • hello

    i dont konw that how to use GetKinectCoreWindowForCurrentThread() function

    can i get a sample source code(c++)??

    Tuesday, January 27, 2015 4:59 AM
  • That is not a sample provided by the SDK so we do not have a link for you. Just an FYI, it doesn't use the interactions library but its own tracking system as described in the video. It is using body joint data and coming up with a pointer strategy.

    Carmine Sirignano - MSFT

    Tuesday, January 27, 2015 6:10 PM
  • Thank you

    can you see this code?

    this method is made by me i should control Hand Cursor(image) it be used return value(x,y) but to go down fall in performence

    i need a both hands in value but now i get a left hand

    what am i going to do?

    here is code

    D2D1_POINT_2F CPointerPoint::UpdateCoreWindow()
    {
    	HandType handType = HandType_NONE;
    	float handReachExtent = 0.0f;
    
    	HRESULT hr;
    
    	hr = GetKinectCoreWindowForCurrentThread(&m_pKinectCoreWindow);
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectCoreWindow->SubscribePointerMoved(&m_pMHandle);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectCoreWindow->GetPointerMovedEventData(m_pMHandle, &m_pKinectEventArgs);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectEventArgs->get_CurrentPoint(&m_pKinectPointer);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectPointer->get_Position(&poistionPoint);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectPointer->get_Properties(&m_pKinectProperties);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectProperties->get_HandReachExtent(&handReachExtent);
    	}
    
    	if (SUCCEEDED(hr))
    	{
    		hr = m_pKinectProperties->get_HandType(&handType);
    	}
    
    	return D2D1::Point2F(poistionPoint.X, poistionPoint.Y);
    
    }

    Thursday, January 29, 2015 6:30 AM
  • You say there is an issue with performance? How long does this function take to execute? What profiling have you done? Why are you continuously getting the core window?

    Carmine Sirignano - MSFT

    Thursday, January 29, 2015 7:03 PM