Kinect for Windows V2 and V1 to develop the use of more than one Kinect

Source: Internet
Author: User

For V1

<span style= "White-space:pre" ></span>inuisensor * pnuisensor; HRESULT Hr;int isensorcount = 0;hr = Nuigetsensorcount (&isensorcount); if (FAILED (HR)) {return hr;} Poll each Kinect sensorfor (int i = 0; i < Isensorcount; ++i) {//Create the sensor so we can check status, if we can ' t cre Ate it, move on to the NEXTHR = Nuicreatesensorbyindex (i, &pnuisensor); if (FAILED (HR)) {continue;} Get the sensor status, and if connected, initialize hr = Pnuisensor->nuistatus (); if (S_OK = = hr) {m_pnuisensor = Pnuisensor;break;} If not used, release pnuisensor->release ();}

For V2


More than one Kinect
    ikinectsensorcollection* pkinectcollection = nullptr;    ienumkinectsensor* penumkinect = nullptr;    ikinectsensor* pkinect = nullptr;    Get Kinect collection    HRESULT hr =:: Getkinectsensorcollection (&pkinectcollection);    Gets the Kinect enumerator    if (SUCCEEDED (HR)) {        hr = Pkinectcollection->get_enumerator (&penumkinect);    }    Enumerates the Kinect    if (SUCCEEDED (HR)) {        BOOLEAN available = false;        while (true) {            //Gets the next            if (SUCCEEDED (Penumkinect->getnext (&pkinect))) {                //judging validity                Pkinect->get_isavailable (&available);                if (Available && Yourjudgmentfunc (Pkinect)) {break                    ;                }                Saferelease (Pkinect);            }            else break                ;        }    }    Saferelease (penumkinect);    Saferelease (pkinectcollection);


Kinect for Windows V2 and V1 to develop the use of more than ___ Kinect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.