Items with no label
3335 Discussions

real time blob tracking with sr300

aadna3
Novice
2,630 Views

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

# include

# include

# include

# include

# include

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 ;

}

11 Replies
idata
Employee
556 Views

Hi adnankhalil42,

 

 

Thank you for contacting us.

 

 

Does your program just close without any message or log?

 

Which SDK are you using? The Blob Tracking feature for the SR300 is only available in the 2016 R2 of the SDK as shown here http://registrationcenter-download.intel.com/akdlm/irc_nas/9558/release_notes_RealSense_SDK_2016_R3.pdf http://registrationcenter-download.intel.com/akdlm/irc_nas/9558/release_notes_RealSense_SDK_2016_R3.pdf so that might be why you're having trouble with the blob tracking code.

 

In case you're using SDK R3, I'd suggest you to go back to R2 and let us know your results.

 

 

We'll be waiting for your response.

 

 

-Sergio

 

0 Kudos
aadna3
Novice
556 Views

Thank you for reply Sir,

The program '[1200] Sr300.exe' has exited with code 0 (0x0). this message show me after debugging .

0 Kudos
idata
Employee
556 Views

Hi,

 

 

The code looks good in general but I've a couple of comments. First, what's specifically the goal of your goal?

 

 

Also, take a look at the following comments:

 

 

-There's a section in the configuration of the blob https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_blob_configuring_the_blob_module.html https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_blob_configuring_the_blob_module.html that says that you can call more configuration methods. You can use the functions below to further configure your code.

 

 

-If you're using the sample code from the documentation as a guide I'd recommend you to use the same capitalization guidelines.

 

 

-In this line blobData->QueryBlob(i, PXCBlobData::SEGMENTATION_IMAGE_DEPTH, PXCBlobData::ACCESS_ORDER_RIGHT_TO_LEFT, pBlob); you're missing a & just before pBlob.

 

 

Check these suggestions out and let me know if you see an improvement and manage to run the code.

 

 

-Sergio

 

0 Kudos
aadna3
Novice
556 Views

thank you for reply ,

Sir i want to write a code for show blob viewer it is my first goal and next to show contours in 3D .

0 Kudos
idata
Employee
556 Views

What were the results of trying our previous suggestions? What were the results of fixing the line blobData->QueryBlob(i, PXCBlobData::SEGMENTATION_IMAGE_DEPTH, PXCBlobData::ACCESS_ORDER_RIGHT_TO_LEFT, &pBlob);

 

 

Also, I noticed you added a return 1 at the end of your code which wasn't in the sample code guide. In C++, returning anything except 0 just means that there was an error. Could you try to change this to see if you see a different result?

 

 

Let us know if you're able to solve this issue.

 

 

-Sergio

 

0 Kudos
aadna3
Novice
556 Views

The program '[8512] blob tracking.exe' has exited with code 0 (0x0).

program end from this last message automatically...

0 Kudos
idata
Employee
556 Views

I understand that the program closes automatically with code 0(0x0). Does this still happen after alerting the line we recommended on our previous reply? Did you make any change to the "return 1"line?

 

 

Have you already tried to use one of the sample codes? I believe in R2 you can find a sample to Blob Tracking in C:\Program Files (x86)\Intel\RSSDK\sample.

 

 

We'll be waiting for your response

 

 

-Sergio

 

0 Kudos
aadna3
Novice
556 Views

yes its give me error message when i write & in that line i search it online but i didnt understand .

Error 1 error C2664: 'pxcStatus PXCBlobData::QueryBlob(const pxcI32,PXCBlobData::SegmentationImageType,PXCBlobData::AccessOrderType,PXCBlobData::IBlob *&)' : cannot convert argument 4 from 'PXCBlobData::IBlob **' to 'PXCBlobData::IBlob *&' c:\users\realsense\documents\visual studio 2013\projects\blob tracking\blob tracking\source.cpp 52 1 blob tracking

2 IntelliSense: initial value of reference to non-const must be an lvalue c:\Users\realsense\Documents\Visual Studio 2013\Projects\blob tracking\blob tracking\Source.cpp 52 45 blob tracking

0 Kudos
idata
Employee
556 Views

At this point I'd recommend you to use the blob viewer sample on the SDK R2. With the SDK installed, go to the RealSense SDK folder and open the "Intel RealSense SDK Sample Browser". There you can see the sample codes available. There's a Blob Viewer example available.

 

 

Let us know if this works.

 

 

-Sergio

 

0 Kudos
idata
Employee
556 Views

Hi adnankhalil42,

 

 

We were wondering if you had a chance to review the information we sent you and to work with the SDK.

 

 

-Sergio

 

0 Kudos
aadna3
Novice
556 Views

yeah i am using 2016 R2

0 Kudos
Reply