11 Replies Latest reply on Jan 25, 2017 1:19 PM by Intel Corporation

    real time blob tracking with sr300

    adnankhalil42

      dear sir i want to write a simple code  for real time blob tracking of objects . i write one of code from help of intel documentation but they automatically close after run .. please check it for me if there any mistake .thank you so much  

       

       

       

       

      #include<Windows.h>

      #include<wchar.h>

      #include<pxcsensemanager.h>

      #include<pxcblobconfiguration.h>

      #include<pxcblobdata.h>

      #include<pxcblobmodule.h>

       

       

      int wmain(int argc, WCHAR* argv[])

      {

        PXCSenseManager*sm = PXCSenseManager::CreateInstance();

        //enable blob modul

        sm->EnableBlob();

        //get intacne of pxcblobmodule

        //PXCBlobModule*blobmodule = 0;

        PXCBlobModule* blobmodule = sm->QueryBlob();

        //configration

       

       

       

        PXCBlobConfiguration*blobconfig = blobmodule->CreateActiveConfiguration();

        blobconfig->SetBlobSmoothing(0.7);

        //PXCBlobConfiguration::ApplyChanges();

        blobconfig->ApplyChanges();

        // Create an output.

        PXCBlobData* blobData = blobmodule->CreateOutput();

       

       

        // Streaming

        while (sm->AcquireFrame(true) >= PXC_STATUS_NO_ERROR) {

        // Get extracted blobs

        blobData->Update(); // update to the current blob data

        // Iterate over blobs from right to left

        pxcI32  iBlobsNum = blobData->QueryNumberOfBlobs();

       

       

        for (int i = 0; i < iBlobsNum; i++) {

        PXCBlobData::IBlob * pBlob = NULL;

        blobData->QueryBlob(i, PXCBlobData::SEGMENTATION_IMAGE_DEPTH,

        PXCBlobData::ACCESS_ORDER_RIGHT_TO_LEFT, pBlob);

        // handle extracted blob data

        pxcI32 nContours = pBlob->QueryNumberOfContours();

       

       

        }

        // Next frame

        sm->ReleaseFrame();

        }

        // Clean Up

        blobData->Release();

        return 1 ;

      }